Brief Announcement: Update Consistency in Partitionable Systems MatthieuPerrin,AchourMoste´faoui,andClaudeJard 5 LINA–UniversityofNantes,2ruedelaHoussinie`re,44322NantesCedex3,France 1 [email protected] 0 [email protected] 2 [email protected] n a Data replication is essential to ensure reliability, availability and fault- J tolerance of massive distributed applications over large scale systems such 9 as the Internet. However, these systems are prone to partitioning, which by ] Brewer’sCAPtheorem[1]makesitimpossibletouseastrongconsistencycri- C terionlikeatomicity.Eventualconsistency[2]guarantiesthatallreplicaseven- D tuallyconvergetoacommonstatewhentheparticipantsstopupdating.How- . ever,itfailstofullyspecifysharedobjectsandrequiresadditionalnon-intuitive s c and error-prone distributed specification techniques, that must take into ac- [ countallpossibleconcurrenthistoriesofupdatestospecifythiscommonstate 1 [3].Thisapproach,thatcanleadtospecificationsascomplicatedastheimple- v mentationsthemselves,islimitedbyamoreseriousissue.Theconcurrentspec- 5 ificationofobjectsusesthenotionofconcurrentevents.Inmessage-passingsys- 7 tems,twoeventsareconcurrentiftheyareenforcedbydifferentprocessesand 1 eachprocessenforceditseventbeforeitreceivedthenotificationmessagefrom 2 0 the other process. In other words, the notion of concurrency depends on the . implementation of the object, not on its specification. Consequently, the final 1 0 usermaynotknowiftwoeventsareconcurrentwithoutexplicitlytrackingthe 5 messages exchanged by the processes. A specification should be independent 1 ofthesystemonwhichitisimplemented. : v We believe that an object should be totally specified by two facets: its ab- i X stractdatatype,thatcharacterizesitssequentialexecutions,andaconsistency r criterion, that defines how it is supposed to behave in a distributed environ- a ment. Not only sequential specification helps repealthe problemof intention, italsoallowstousethewellstudiedandunderstoodnotionsoflanguagesand automata. This makes possible to applyall the tools developed for sequential systems, from their simple definition using structures and classes to the most advancedtechniqueslikemodelcheckingandformalverification. Eventual consistency (EC) imposes no constraint on the convergent state, that very few depends on the sequential specification. For example, an im- plementation that ignores allthe updatesis eventually consistent, as allrepli- cas converge to the initial state. We propose a new consistency criterion, up- date consistency (UC), in which the convergent state must be obtained by a total ordering of the updates, that contains the sequential order of each pro- I(•1) D(•2) R{•1} Rω{•2} I(•1) D(•2) R{•1} Rω{•1,2} I(•1) D(•2) R{•1} Rω{•1} • • • • • • • • • • • • I(2) D(1) R∅ Rω{1} I(2) D(1) R∅ Rω{1,2} I(2) D(1) R∅ Rω{1} (a)NotECandnotUC (b)ECbutnotUC (c)ECandUC Fig.1:Threehistoriesforasetofintegers,withdifferentconsistencycriteria.An eventlabeledωisrepeatedinfinitelyoften. cess. Another equivalent way to approachit is that, if the number of updates is finite, it is possible to remove a finite number of queries such that the re- maining history is sequentially consistent. Unlike Fig. 1a, Fig. 1b presents an eventuallyconsistenthistory,asbothprocessesread{1,2}oncetheyhavecon- verged.However,itisnotupdateconsistent:inanylinearizationoftheupdates, a deletion must appear as the last update, so this history cannot converge to state{1,2}.State{1}ispossible becausethe updatescanbedoneinthe order I(2),D(1),I(1),D(2), so Fig. 1c, is update consistent. As update consistency is strictly stronger than eventualconsistency, anupdate consistent objectcan al- waysbeusedinsteadofitseventuallyconsistentcounterpart. We can prove that update consistency is universal, in the sense that ev- ery object has anupdate consistent implementation in a partitionable system, whereanynumber of crashesareallowed.The principle is tobuild a totalor- derontheupdatesonwhichalltheparticipantsagree,andthentorewritethe historyaposteriorisothateveryreplicaoftheobjecteventuallyreachesthestate correspondingtothecommonsequentialhistory.Anystrategytobuildtheto- talorderontheupdateswouldwork.Forexample,thisordercanbebuiltfrom a timestamp made of a Lamport’sclock [4] and the id of the processthatper- formedit.Thegenericityoftheproposedalgorithmisveryimportantbecauseit maygiveasubstitutetocomposability.Composabilityisanimportantproperty ofconsistencycriteriabecauseitallowstoprograminamodularway,butitis very difficult to achieve for consistency criteria. A same algorithm that pilots severalobjectsduringasameexecutionallowsthisexecutiontobeupdatecon- sistent. Thisuniversalityresultallowstoimagine automatic compilationtech- niquesthatcomposespecificationsinsteadofimplementations. References 1. Gilbert,S.,Lynch,N.: Brewer’sconjectureandthefeasibilityofconsistent,available, partition-tolerantwebservices. ACMSIGACTNews33(2002)51–59 2. Vogels,W.: Eventuallyconsistent. Queue6(2008)14–19 3. Burckhardt,S.,Gotsman,A.,Yang,H.,Zawirski,M.: Replicateddatatypes:specifi- cation,verification,optimality. In:Proceedingsofthe41stannual ACMSIGPLAN- SIGACTsymposiumonPrinciplesofprogramminglanguages,ACM(2014)271–284 4. Lamport,L.: Time,clocks,andtheorderingofeventsinadistributedsystem. Com- municationsoftheACM21(1978)558–565