Documente Academic
Documente Profesional
Documente Cultură
Data Replication
obj
obj
obj
Increased
Node 4 Node 1 Node 5
availability
Shorter response
times A C B C
Node 2 Node 3
D D
Higher throughput
Parallel processing
of requests Node 6 Node 7
Less
communication B
A
overhead D
Questions:
Which operations are
still possible during a
partitioning?
What has to be done
after recovery from
network partitioning?
syntactic semantic
Syntactic consistency
Process the syntax of data but do not know the
meaning of it
Example: HOLA (string)
Example: 5 (number)
syntactic semantic
Semantic consistency
Have special application knowledge about data
Example: measured temperature
36,6C and 36,7C are considered to be equal
Example: unordered elements in a set
{A, B, C, D} equals {D, A, B, C}
syntactic semantic
Pessimistic methods
Consistent data in every failure situation
Guaranteed one-copy serializability
But at limited availability during failures
syntactic semantic
Optimistic methods
Increase the availability of data
Accept temporary inconsistencies in case of failures
Accept non-serializable executions
Usually with a specific application scenario in mind,
which tolerates inconsistencies
cost cost
write read
read write
1. Synchronization protocol
2. Replication management protocol
3. Update protocol for physical copies
1. Synchronization protocol
Synchronizes physical operations on object copies
e.g. distributed locking or distributed 2PL
Guarantees serializability on a physical object
But: No guarantee for one-copy serializability (does
not manage multiple copies of the same object)
1. Synchronization protocol
2. Replication management protocol
Maps logical read/write operations to physical ones
e.g. Read One, Write All:
logical read read one of the physical objects
logical write write all physical objects
Guarantees together with the synchronization
protocol (1.) one-copy serializability
1. Synchronization protocol
2. Replication management protocol
3. Update protocol for physical copies
Node failures and partitioning cause physical copies
to become stale (outdated)
Update protocol makes outdated copies current
(up-to-date) after recovery from failure
Sometimes combined with replication management
Logical object: x
Physical copy of x on
node p: xp
Set of all copies of x:
copies[x]
Set of all nodes with
copies of x: nodes[x]
Number of copies of x: n[x]
Read/write x : r[x] / w[x]
Read/write xp : r[xp] / w[xp]
Read: Write:
x1 .... xp . . . xn x1 .... xp . . . xn
reading writing
x x
read write
pk = 0,99; n = 4 pw 0,9606
pk = 0,99; n = 10 pw 0,9044
Read: Write:
x* x1 . . . . xp . . . xn
x* x1 .... xp . . . xn writing
1. Network Partitioning
Read/write succeeds as long as the primary copy is
available in the network partition
Only primary copy + available copies are written
Votes:
Each copy gets a number of votes
The copies vote on each operation
Quorum:
A set of copies with a certain minimum number of
votes forms a quorum
A read or write operation needs a read or write
quorum, respectively
Read: Write:
majority
xA xD xA xD majority
xC xC
xE xE
xB xB
reading writing
x read write x
partition 1 partition 2
Each operation will have to
access 3 of the 4 copies
Read quorum Qr : q [ x p ] q r[ x ]
pQ r
Write quorum Qw : q [ x p ] q w[ x ]
pQ w
Example: 4 copies
1. Majority Consensus: 2. Weighted Voting
2 votes
Pessimistic Methods
Two extremes: Read One, Write All
Read All, Write One
(compromises between those two are possible)
Primary Copy (requires update protocol)
Majority Consensus
Weighted voting
Optimistic Methods
Update as soon as possible