maintaining sql invariants in weakly consistent … · sonic pacman mario tournament a b player...

49
MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT DATABASES Nuno Preguiça (NOVA LINCS, FCT/Universidade NOVA de Lisboa) Joint work with: Valter Balegas, Cheng Li (MPI, now Oracle), João Sousa, David Lopes, Sérgio Duarte, Carla Ferreira, João Leitão, Allen Clement (MPI, now Google), Viktor Vafeiadis (MPI), Rodrigo Rodrigues (now Inesc-Id/IST)

Upload: others

Post on 17-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT DATABASES

Nuno Preguiça (NOVA LINCS, FCT/Universidade NOVA de Lisboa)

Joint work with:Valter Balegas, Cheng Li (MPI, now Oracle), João Sousa, David Lopes, Sérgio Duarte, Carla Ferreira, João Leitão, Allen Clement (MPI, now Google), Viktor Vafeiadis (MPI), Rodrigo Rodrigues (now Inesc-Id/IST)

Page 2: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

INTERNET SERVICES NOWADAYS

• Services operate on a global scale.

• An unprecedented number of people are using Internet services.

• Systems use geo-replication for low latency and high availability.

2

Page 3: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

GEO-REPLICATION

3

20 ms

150 ms

20 ms

SYNC DC2

DC1

Page 4: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

GEO-REPLICATION

4

DC2

DC1

Page 5: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

GEO-REPLICATION

5

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

create table player( id varchar(20), primary key id)

create table tournament( id varchar(20), primary key id)

create table pt( p varchar(20), t varchar(20), foreign key (p) REFERENCES player (id), foreign key (t) REFERENCES tournament (id))

Page 6: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

GEO-REPLICATION

6

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Pacman, A

enroll(Pacman, A):insert into PT values(‘Pacman’,’A’)

Page 7: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

GEO-REPLICATION

7

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Pacman, A

enroll(Mario, A):insert into PT values(‘Mario’,’A’)

PT

Sonic, A

Sonic, B

Mario, A

Page 8: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

Pacman, A

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

8

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

removeTournament(A):delete from tournament where id = ’A’

delete from PT where t = ’A’

Page 9: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

Pacman, A

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

9

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

SYNC

Page 10: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

Pacman, A

Mario, A

PT

Sonic, A

Sonic, B

Pacman, A

Mario, A

GEO-REPLICATION

10

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

SYNC

Mario is enrolled in tournament that was

concurrently removed.Referential integrity

violation.

Page 11: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

OUTLINE

• Context / problem• First take: Sieve• Second take: SQL IPA• Final remarks

11

Page 12: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

RedBlue ConsistencyBuilds replicated systems that are fast and correct

Page 13: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

RedBlue ConsistencyBuilds replicated systems that are fast and correct

Blue ops: local, fast, weakly consistent

Page 14: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

RedBlue ConsistencyBuilds replicated systems that are fast and correct

State convergence

Invariant preservation

Blue ops: local, fast, weakly consistent

Page 15: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

RedBlue ConsistencyBuilds replicated systems that are fast and correct

State convergence

Invariant preservation

Blue ops: local, fast, weakly consistent

Red ops: global, slow, strongly consistent

Page 16: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Choosing between Blue or Red

operation u

commutative?

Red

No

Ensuring state convergence

Page 17: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Choosing between Blue or Red

operation u

commutative?

breaks invariants?

Red Blue

No

Yes

Yes

No

Ensuring state convergence

Ensuring invariant

preservation

Page 18: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Choosing between Blue or Red

operation u

commutative?

breaks invariants?

Red Blue

No

Yes

Yes

No

Ensuring state convergence

Ensuring invariant

preservation

Good performance obtained if blue ops dominate op space

Page 19: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Transforming

Operation stream

Slow,Strongly consistent

Fast,Weakly consistent

Commutative shadow operations

Classifying

Page 20: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Transforming

Operation stream

Commutative shadow operations

Page 21: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Transforming

Operation stream

Commutative shadow operations

Challenges:• Making arbitrary side effects commute• Minimizing human intervention

Page 22: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Transforming

Operation stream

Commutative shadow operations

Challenges:• Making arbitrary side effects commute• Minimizing human intervention

Page 23: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

CRDT Annotation Example

@AUSET CREATE TABLE BankAccount(id INT(11) NOT NULL,

@NUMDELTA balance INT(11) default 0,@LWW name char(60) default NULL,

PRIMARY KEY (id)) ENGINE=InnoDB

Page 24: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

CRDT Annotation Example

@AUSET CREATE TABLE BankAccount(id INT(11) NOT NULL,

@NUMDELTA balance INT(11) default 0,@LWW name char(60) default NULL,

PRIMARY KEY (id)) ENGINE=InnoDB

Page 25: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Transforming

Operation stream

Slow,Strongly consistent

Fast,Weakly consistent

Commutative shadow operations

Classifying

Page 26: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Slow,Strongly consistent

Fast,Weakly consistent

Commutative shadow operations

Classifying

Page 27: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Slow,Strongly consistent

Fast,Weakly consistent

Commutative shadow operations

Classifying

Challenge:• How to classify accurately and efficiently?

Page 28: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

SIEVE

Slow,Strongly consistent

Fast,Weakly consistent

Commutative shadow operations

Classifying

Challenge:• How to classify accurately and efficiently?

Page 29: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

OUTLINE

• Context / problem• First take: Sieve• Second take: SQL IPA• Final remarks

29

Page 30: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Limitations of Sieve

• Operations that may violate the invariant need to be red/coordinated => slow– Acquiring reservation/token (Indigo/CISE)

• Static analysis of complete application(s)– Changes in applications require rerunning the

analysis process

30

Page 31: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Limitations of Sieve

• Operations that may violate the invariant need to be blue/coordinated => slow– Acquiring reservation/token (Indigo/CISE)

• Static analysis of complete application(s)– Changes in applications require rerunning the

analysis process

31

Goal: maintain invariants while avoiding coordination

Page 32: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Tournament

A

B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

GEO-REPLICATION

32

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

removeTournament(A):delete from tournament where id = ’A’

delete from PT where t = ’A’

Page 33: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

33

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)

Page 34: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

34

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)touch tournament where id = ‘A’

Page 35: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

35

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)touch tournament where id = ‘A’

touch cascade PT where t=’A’

Page 36: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

36

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)touch tournament where id = ‘A’

touch cascade PT where t=’A’

removeTournament(A):delete from tournament where id = ’A’

delete cascade from PT where t = ’A’

Page 37: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

37

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

SYNC

Rules add-wins:1. || => 2. || =>

Page 38: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

38

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

SYNC

Rules add-wins:1. || => 2. || =>

Page 39: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Other invariants

• Primary key (uniqueness)– Split keyspace

• Check constraint– E.g. stock int CHECK (stock >= 0)– Solved using bounded counter (escrow)

39

Page 40: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Limitations of Sieve

• Operations that may violate the invariant need to be blue/coordinated => slow– Acquiring reservation/token (Indigo/CISE)

• Static analysis of complete application(s)– Changes in applications require rerunning the

analysis process

40

Goal: “modify” operations in runtime.Use schema definition.

Page 41: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

41

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)

create table player( id varchar(20), primary key id)

create table tournament( id varchar(20), primary key id)

create table pt( p varchar(20), t varchar(20), foreign key (p) REFERENCES player (id), foreign key (t) REFERENCES tournament (id))

Page 42: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

PT

Sonic, A

Sonic, B

Mario, A

GEO-REPLICATION

42

Tournament

A

B

Player

Sonic

Pacman

Mario

Tournament

A

B

Player

Sonic

Pacman

Mario

DC2

DC1

enroll(Mario, A):insert into PT values(‘Mario’,’A’)touch tournament where id = ‘A’touch player where id = ‘Mario’

create table player( id varchar(20), primary key id)

create table tournament( id varchar(20), primary key id)

create table pt( p varchar(20), t varchar(20), AW foreign key (p) REFERENCES player (id), AW foreign key (t) REFERENCES tournament (id))

Page 43: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

OUTLINE

• Context / problem• First take: Sieve• Second take: SQL IPA• Final remarks

43

Page 44: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Status

• Implementing prototype on top of Antidote database

• Runtime solution equivalent to static solution implemented in IPA

44

Page 45: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Impact of additional updates

0 10 20 30 40

1 2 4 8 16 32 64

Spee

d-up

Number of updated Keys

IPA/Strong

45

Page 46: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

TOURNAMENT

46

0 50

100 150 200 250 300 350

0 50 100 150 200 250 300 350 400

Late

ncy

[ms]

Throughput [TP/s]

StrongIndigo

IPACausal

Page 47: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

TOURNAMENT: OPERATIONS LATENCY

47

0 50

100 150 200 250 300

BeginFinish

Remove

DoMatch

EnrollDisenroll

Status

Late

ncy

[ms] Indigo

IPACausal

Page 48: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

Final remarks

• SQL schema allows to define constraints• First approach– Coordinate on operations that may break invariants

• Second approach–Maintain invariants without coordination (or

minimizing coordination)

48

Page 49: MAINTAINING SQL INVARIANTS IN WEAKLY CONSISTENT … · Sonic Pacman Mario Tournament A B Player Sonic Pacman Mario DC2 DC1 PT Sonic, A Sonic, B PT Sonic, A Sonic, B create table player(

QUESTIONS?

Valter Balegas – NOVA LINCS, FCT-UNL - Putting Consistency Back Into Eventual Consistency @ Eurosys'15 49