versioning, consistency, and agreement · 2013. 10. 10. · 1 jenkins, if i want another yes‐man,...
TRANSCRIPT
![Page 1: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/1.jpg)
Versioning,Consistency,andAgreement
COS461:ComputerNetworksSpring2010(MW3:00‐4:20inCS105)
MikeFreedmanhIp://www.cs.princeton.edu/courses/archive/spring10/cos461/
1
Jenkins,ifIwantanotheryes‐man,I’llbuildone!
Lee Lorenz, Brent Sheppard
![Page 2: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/2.jpg)
Timeanddistributedsystems
• WithmulPpleevents,whathappensfirst?
A shoots B
B dies 2
![Page 3: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/3.jpg)
Timeanddistributedsystems
• WithmulPpleevents,whathappensfirst?
A dies
B shoots A
3
![Page 4: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/4.jpg)
Timeanddistributedsystems
• WithmulPpleevents,whathappensfirst?
A shoots B
B dies A dies
B shoots A
4
![Page 5: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/5.jpg)
JustusePmestamps?
• Needsynchronizedclocks
• ClocksynchviaaPmeserver
p Time server S
5
![Page 6: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/6.jpg)
• Usesa!meservertosynchronizeclocks
• TimeserverkeepsthereferencePme
• ClientsaskserverforPmeandadjusttheirlocal
clock,basedontheresponse
– Butdifferentnetworklatency→clockskew?
• Correctforthis?Forlinkswithsymmetricallatency:
CrisPan’sAlgorithm
adjusted-local-time = server-timestamp t + (RTT / 2)
local-clock-error = adjusted-local-time – local-time
RTT = response-received-time – request-sent-time
6
![Page 7: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/7.jpg)
Isthissufficient?
• Serverlatencyduetoload?– Ifcanmeasure:
• adjusted‐local‐Pme=server‐Pmet+(RTT+lag)/2
• Butwhataboutasymmetriclatency?– RTT/2notsufficient!
• WhatdoweneedtomeasureRTT?– Requiresnoclockdrib!
• Whatabout“almost”concurrentevents?– Clockshavemicro/milli‐secondprecision
7
![Page 8: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/8.jpg)
EventsandHistories
• Processesexecutesequencesofevents
• Eventscanbeof3types:– local,send,andreceive
• Thelocalhistoryhpofprocesspisthesequenceofeventsexecutedbyprocess
8
![Page 9: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/9.jpg)
Orderingevents
• ObservaPon1:– Eventsinalocalhistoryaretotallyordered
time!pi
9
![Page 10: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/10.jpg)
Orderingevents
• ObservaPon1:– Eventsinalocalhistoryaretotallyordered
• ObservaPon2:– Foreverymessagem,send(m)precedesreceive(m)
time!
time!
time!
pi
pi
pj
m
10
![Page 11: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/11.jpg)
Happens‐Before(Lamport[1978])
• RelaPvePme?DefineHappens‐Before(→):– Onthesameprocess:a→b,if!me(a)<!me(b)
– Ifp1sendsmtop2:send(m)→receive(m)
– Ifa→bandb→cthena→c
• LamportAlgorithmusesforparPalordering:– Allprocessesuseacounter(clock)withiniPalvalueof0– Counterincrementedbyandassignedtoeachevent,as
itsPmestamp
– Asend(msg)eventcarriesitsPmestamp
– Forreceive(msg)event,counterisupdatedbyMax(receiver‐counter,message‐Pmestamp)+1
11
![Page 12: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/12.jpg)
EventsOccurringatThreeProcesses
12
![Page 13: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/13.jpg)
LamportTimestamps
1
1
2
3 4
5
13
![Page 14: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/14.jpg)
LamportLogicalTime
Host 1
Host 2
Host 3
Host 4
1
2
2
3
3
5
4
5
3
6
4
6
7
8
0
0
0
0
1
2
4
3 3
4
7
Physical Time
14
![Page 15: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/15.jpg)
LamportLogicalTime
Host 1
Host 2
Host 3
Host 4
1
2
2
3
3
5
4
5
3
6
4
6
7
8
0
0
0
0
1
2
4
3 3
4
7
Physical Time
Logically concurrent events!
15
![Page 16: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/16.jpg)
VectorLogicalClocks• WithLamportLogicalTime
– eprecedesf⇒Pmestamp(e)<Pmestamp(f),but
– Pmestamp(e)<Pmestamp(f)⇒eprecedesf
16
![Page 17: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/17.jpg)
VectorLogicalClocks• WithLamportLogicalTime
– eprecedesf⇒Pmestamp(e)<Pmestamp(f),but
– Pmestamp(e)<Pmestamp(f)⇒eprecedesf
• VectorLogicalPmeguaranteesthis:– Allhostsuseavectorofcounters(logicalclocks),ithelementistheclockvalueforhosti,iniPally0
– Eachhosti,incrementstheithelementofitsvectoruponanevent,assignsthevectortotheevent.
– Asend(msg)eventcarriesvectorPmestamp
– Forreceive(msg)event,
Max(Vreceiver[j],Vmsg[j]), ifjisnotself
Vreceiver[j]+1 otherwiseVreceiver[j] =
17
![Page 18: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/18.jpg)
VectorTimestamps
18
![Page 19: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/19.jpg)
VectorLogicalTime
Host 1
Host 2
Host 3
Host 4
1,0,0,0
Physical Time
1,1,0,0
1,0,0,0
1,2,0,0
2,2,3,0
1,2,0,0
2,0,0,0
2,0,1,0 2,0,2,0
Vreceiver[j] =
2,0,2,1
Max(Vreceiver[j],Vmsg[j]), ifjisnotself
Vreceiver[j]+1 otherwise
19
![Page 20: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/20.jpg)
ComparingVectorTimestamps
• a=b iftheyagreeateveryelement
• a<b ifa[i]<=b[i]foreveryi,but!(a=b)• a>b ifa[i]>=b[i]foreveryi,but!(a=b)• a||b ifa[i]<b[i],a[j]>b[j],forsomei,j(conflict!)
• Ifonehistoryisprefixofother,thenonevectorPmestamp<other
• Ifonehistoryisnotaprefixoftheother,then(atleastbyexample)VTswillnotbecomparable.
20
![Page 21: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/21.jpg)
GivenanoPonofPme…
…What’sanoPonofconsistency?
21
![Page 22: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/22.jpg)
StrictConsistency
• Strongestconsistencymodelwe’llconsider– AnyreadonadataitemXreturnsvaluecorrespondingtoresultofthemostrecentwriteonX
• NeedanabsoluteglobalPme– “Mostrecent”needstobeunambiguous
x
WritextoaReadxreturnsa
22
![Page 23: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/23.jpg)
Whatelsecanwedo?
• Strictconsistencyistheidealmodel– Butimpossibletoimplement!
• SequenPalconsistency– Slightlyweakerthanstrictconsistency– DefinedforsharedmemoryformulP‐processors
23
![Page 24: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/24.jpg)
SequenPalConsistency
• DefiniPon:ResultofanyexecuPonisthesameasifall(readandwrite)operaPonsondatastorewereexecutedinsomesequenPalorder,andtheoperaPonsofeachindividualprocessappearinthissequenceintheorderspecifiedbyitsprogram
• DefiniPon:Whenprocessesarerunningconcurrently:– InterleavingofreadandwriteoperaPonsisacceptable,butallprocessesseethesameinterleavingofoperaPons
• Differencefromstrictconsistency– NoreferencetothemostrecentPme
– AbsoluteglobalPmedoesnotplayarole24
![Page 25: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/25.jpg)
ValidSequenPalConsistency?
x 25
![Page 26: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/26.jpg)
Linearizability
• Linearizability– Weakerthanstrictconsistency– StrongerthansequenPalconsistency
• AlloperaPons(OP=read,write)receiveaglobalPme‐stampusingasynchronizedclock
• Linearizability:– RequirementsforsequenPalconsistency,plus
– Iftsop1(x)<tsop2(y),thenOP1(x)shouldprecedeOP2(y)inthesequence
26
![Page 27: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/27.jpg)
CausalConsistency
• NecessarycondiPon:– Writesthatarepoten&allycausallyrelatedmustbeseenbyallprocessesinthesameorder.
– Concurrentwritesmaybeseeninadifferentorderondifferentmachines.
• WeakerthansequenPalconsistency
• Concurrent:Opsthatarenotcausallyrelated
27
![Page 28: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/28.jpg)
CausalConsistency
• Allowedwithcausalconsistency,butnotwithsequenPalorstrictconsistency
• W(x)bandW(x)careconcurrent– Soallprocessesdon’tseetheminthesameorder
• P3andP4readthevalues‘a’and‘b’inorderaspotenPallycausallyrelated.No‘causality’for‘c’.
28
![Page 29: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/29.jpg)
CausalConsistency
x
29
![Page 30: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/30.jpg)
CausalConsistency
• Requireskeepingtrackofwhichprocesseshaveseenwhichwrites
– Needsadependencygraphofwhichopisdependentonwhichotherops
– …orusevectorPmestamps!
30
![Page 31: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/31.jpg)
Eventualconsistency• Ifnonewupdatesaremadetoanobject,abersomeinconsistencywindowcloses,allaccesseswillreturnthelastupdatedvalue
• Prefixproperty:– IfPihaswritewacceptedfromsomeclientbyPj– ThenPihasallwritesacceptedbyPjpriortow
• Usefulwhereconcurrencyappearsonlyinarestrictedform
• AssumpPon:writeconflictswillbeeasytoresolve– Eveneasierifwhole‐”object”updatesonly
31
![Page 32: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/32.jpg)
Systemsusingeventualconsistency
• DB:updatedbyafewproc’s,readbymany– Howfastmustupdatesbepropagated?
• Webpages:typicallyupdatedbysingleuser– So,nowrite‐writeconflicts– Howevercachescanbecomeinconsistent
32
![Page 33: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/33.jpg)
Systemsusingeventualconsistency
• DNS:eachdomainassignedtoanamingauthority– Onlymasterauthoritycanupdatethenamespace– OtherNSserversactas“slave”servers,downloadingDNSzonefilefrommasterauthority
– So,write‐writeconflictswon’thappen
– Isthisalwaystruetoday?
[email protected].( 18 ;serial 1200 ;refresh 600 ;retry 172800 ;expire 21600);minimum
33
![Page 34: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/34.jpg)
TypicalimplementaPonofeventualconsistency
• Distributed,inconsistentstate– Writesonlygotosomesubsetofstoragenodes
• Bydesign(forhigherthroughput)• Duetotransmissionfailures
• “AnP‐entropy”(gossiping)fixesinconsistencies– Usevectorclocktoseewhichisolder– Prefixpropertyhelpsnodesknowconsistencystatus– IfautomaPc,requiressomewaytohandlewriteconflicts
• ApplicaPon‐specificmerge()funcPon• Amazon’sDynamo:UsersmayseemulPpleconcurrent“branches”beforeapp‐specificreconciliaPonkicksin
34
![Page 35: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/35.jpg)
Examples…• Causalconsistency.Non‐causallyrelatedsubjecttonormaleventualconsistencyrules
• Read‐your‐writesconsistency.
• Sessionconsistency.Read‐your‐writesholdsiffclientsessionexists.Ifsessionterminates,noguaranteesbetweensessions.
• Monotonicreadconsistency.Oncereadreturnsaversion,subsequentreadsneverreturnolderversions.
• Monotonicwriteconsistency.Writesbysameprocessareproperlyserialized.Reallyhardtoprogramsystemswithoutthisprocess.
35
![Page 36: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/36.jpg)
Evenread‐your‐writesmaybedifficulttoachieve
36
![Page 37: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/37.jpg)
Whataboutstrongeragreement?
• Two‐phasecommitprotocol
37
• Marriageceremony
• Theater
• Contractlaw
Doyou?Ido.Inowpronounceyou…
Readyontheset?Ready!AcPon!
OfferSignatureDeal/lawsuit
![Page 38: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/38.jpg)
Whataboutstrongeragreement?
• Two‐phasecommitprotocol
38
LeaderAcceptorsAcceptorsAcceptors
PREPARE
READY
COMMIT
ACK
ClientWRITE
ACK
Allprepared?
Allack’d?
![Page 39: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/39.jpg)
Whataboutfailures?
• Ifanacceptorfails:– CansPllensurelinearizabilityif|R|+|W|≥N
– “read”and“write”quorumsoverlapinatleast1node
• Iftheleaderfails?– Loseavailability:systemnotlonger“live”
• Pickanewleader?– Needtomakesureeverybodyagreesonleader!– Needtomakesurethat“group”isknown
39
![Page 40: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/40.jpg)
ConsensusandPaxosAlgorithm• “Consensus”problem
– Nprocesseswanttoagreeonavalue– IffewerthanFfaultsinawindow,consensusachieved
• “Crash”faultsneed2F+1processes• “Malicious”faults(calledByzanPne)need3F+1processes
• CollecPonofprocessesproposingvalues– Onlyproposedvaluemaybechosen
– Onlysinglevaluechosen
• Commonusage:– Viewchange:defineleaderandgroupviaPaxos– Leaderusestwo‐phasecommitforwrites
– Acceptorsmonitorleaderforliveness.Ifdetectfailure,re‐execute“viewchange” 40
![Page 41: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/41.jpg)
Paxos:Algorithm
ViewChangefromcurrentview
Viewi:V={Leader:N2,Group:{N1,N2,N3}}
Phase1(Prepare)• Proposer:Sendpreparewithversion#jtomembersofViewi
• Acceptor:ifj>vers#kofanyotherprepareitseen,respondwithpromisenottoacceptlower‐numberedproposals.Otherwise,
respondwithkandvaluev’accepted.
Phase2(Accept)• Ifmajoritypromise,proposersendsacceptwith(versj,valuev)
• Acceptoracceptsunlessithasrespondedtopreparewithhighervers#thanj.Sendsacknowledgementtoallviewmembers.
41
![Page 42: Versioning, Consistency, and Agreement · 2013. 10. 10. · 1 Jenkins, if I want another yes‐man, I’ll build one! Lee Lorenz ... • Session consistency. Read‐your‐writes](https://reader036.vdocument.in/reader036/viewer/2022081617/60280582d728d144a352495a/html5/thumbnails/42.jpg)
Summary
• GlobalPmedoesn’texistindistributedsystem
• LogicalPmecanbeestablishedviaversion#’s
• LogicalPmeusefulinvariousconsistencymodels– Strict>Linearizability>SequenPal>Causal>Eventual
• Agreementindistributedsystem– Eventualconsistency:Quorums+anP‐entropy
– Linearizability:Two‐phasecommit,Paxos
42