



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Or propagate requests (e.g. txn-bracketed stored proc calls)
Must ensure requests run in the same order at primary andreplica (same requirement as updates or procedure calls).
As for updates, can propagate requests asynchronously, or …
can run requests synchronously at all replicas, but commit even if one replica fails (need a recovery procedure for failed replicas).
If supported, it’s often an app server (not DB) feature.
An alternative to propagating updates is to propagateprocedure calls (e.g., a DB stored procedure call).
SP1: Write(x)
Write(y)
DB-Ax, y
w[x]w[y]
SP1: Write(x)
Write(y)
x, y
DB-B
w[x]w[y]
ReplicateCall(SP1)
Secondary failure - nothing to do till it recovers
At recovery, apply the updates it missed while down
Needs to determine which updates it missed,just like non-replicated log-based recovery
If down for too long, it may be faster to get a whole copy
Primary failure
Normally, secondaries just wait till the primary recovers
Can get higher availability by electing a new primary
A secondary that detects primary’s failure announces a newelection by broadcasting its unique replica identifier
Other secondaries reply with their replica identifier
The largest replica identifier wins
Secondaries can’t distinguish a primary failure from acommunication failure that partitions the network.
If the secondaries elect a new primary and the oldprimary is still running, there will be a reconciliationproblem when they’re reunited. This is multi-master.
To avoid this, one partition must know it’s the only onethat can operate, and can’t communicate with otherpartitions to figure this out.
Could make a static decision.E.g., the partition that has the primary wins.
Dynamic solutions are based on Majority Consensus
Whenever a set of communicating replicas detects areplica failure or recovery, they test if they have amajority (more than half) of the replicas.
If so, they can elect a primary
Only one set of replicas can have a majority.
Doesn’t work with an even number of copies.
Useless with 2 copies
Quorum consensus
Give a weight to each replica
The replica set that has a majority of the weight wins
E.g. 2 replicas, one has weight 1, the other weight 2
Initially x=
1
Initially x= Send (X=1)
Initially x=
2
Send (X=1)
Send (X=2)
Send (X=2)