Docsity

Serializability - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Toggle sidebar
bg1
Thomas’ Write Rule
•To ensure replicas end up in the same state
–Tag each data item with a timestamp
–A transaction updates the value and timestamp of data items
(timestamps monotonically increase)
–An update to a replica is applied only if the update’s timestamp
is greater than the data item’s timestamp
–You only need timestamps of data items that were recently
updated (where an older update could still be floating around
the system)
•All multi-master products use some variation of this
•Robert Thomas, ACM TODS, June ’79
–Same article that invented majority consensus
Docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Serializability - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Thomas’ Write Rule

To ensure replicas end up in the same state

Tag each data item with a timestamp

A transaction updates the value and timestamp of data items(timestamps monotonically increase)

An update to a replica is applied only if the update’s timestampis greater than the data item’s timestamp

You only need timestamps of data items that were recentlyupdated (where an older update could still be floating aroundthe system)

All multi-master products use some variation of this

Robert Thomas,

ACM TODS

, June ’

Same article that invented majority consensus

Thomas Write Rule

Serializability

Replica 1

T

1

: read x=0 (TS=0)

T

1

: X=1, TS=

Primary

Initially x=0,TS=0Send (X=1, TS=1)

Replica 2

T

1

: read x=0 (TS=0) T

2

: X=2, TS=

Send (X=1, TS=1)

X=1, TS=

X=1,TS=

X=2, TS=

Send (X=2, TS=2)

Replicas end in the same state, but neither T

1

nor T

2

reads

the other’s output, so the execution isn’t serializable.

X=2, TS=

Send (X=2, TS=2)

Microsoft Access and SQL Server

Multi-master replication without a primary

Each row R of a table has 4 additional columns

globally unique id (GUID)

generation number, to determine which updates from otherreplicas have been applied

version number = the number of updates to R

array of [replica, version number] pairs, identifying the largestversion number it got for R from every other replica

Uses Thomas’ write rule, based on version numbers

Access uses replica id to break ties. SQL Server 7 usessubscriber priority or custom conflict resolution.

Generation Numbers

(Access/SQL cont’d)

Each replica has a current generation number

A replica updates a row’s generation numberwhenever it updates the row

A replica knows the generation number it had when itlast exchanged updates with R´, for every replica R´.

A replica increments its generation number everytime it exchanges updates with another replica.

So, when exchanging updates with R

, it should send

all rows with a generation number larger than what ithad when it last exchanged updates with R

4. Other Approaches

Non-transactional replication using timestampedupdates and variations of Thomas’ write rule

directory services are managed this way

Quorum consensus per-transaction

Read and write a quorum of copies

Each data item has a version number and timestamp

Each read chooses a replica with largest version number

Each write increments version number one greater than anyone it has seen

No special work needed during a failure or recovery