Distributed Snapshots 1 Goals of the lecture � Consistent State � Algo rithm � Co rrectness � Stable Prop erties Reference: Chandy and Lamp ort � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 2 Case of the dubious dolla rs $400 $300 � � �� �� �� A B picture tak en here ($400) Send $ 100 fr om A to B picture tak en here ($400) The total amount b ecomes $800 � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 3 Problem T o determine global system state Each p ro cess can reco rd its o wn state and messages it sends and receives. No sha red clo ck o r memo ry Analogy: group of photographers � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 4 Mo del of a Distributed System � Finite set of p ro cesses � Finite set of channels c 1 �� � � - p r - �� �� � c I @ 2 @ � @ � @ � c @ � 4 c 3 @ � @ � � @ � � � @ q �� Channel := FIF O, erro r free, and in�nite bu�er � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 5 De�nition of a p ro cess Pro cess P = ( S; I ; E ) � H � H � H � H � H � H � H � ? H j Set of States Initial State Set of Events An event can change the state of P and at most one channel. 0 e = h p; s; s ; m; c i � P � P � � ? @ P � P � P � � @ P � P � P p ost-state � ) � @ R P q p ro cess message channel p re-state � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 6 Global state and global sequence state ( D ) = � state ( p ) � � state ( c ) : i i i j next ( s; e ) = global state immediately after e seq = ( e : 0 � i � n ) is a computation of D i� i s = initial global state 0 s = next ( s ; e ) 0 � i � n i +1 i i � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 7 Example 1 c 1 �� � � - p q � �� �� c 2 p q h s h s 0 1 sendt r ecv t r ecv t sendt q q p p h h s s � � 1 0 � � � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 8 Example 1 [Contd.] c 1 �� � � - p q � �� �� c 2 s s 1 0 hi �� � � - state ( p ) = s 1 � �� �� hi state ( c ) = h tok en i s s 1 0 0 h tok en i �� � � - state ( c ) = hi 2 � �� �� hi state ( q ) = s 0 � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 9 Global State Detection Algo rithm Sending Rule : F o r all channels c directed a w a y from p , p sends one ma rk er after p reco rds its state and b efo re it sends further messages along c . Receiving Rule : On receiving a ma rk er along c if q has not reco rded its state then reco rds its state ma rks c as empt y else state( c ) = h seq of messages i received along c after the state w as reco rded and b efo re ma rk er is received. � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 10 Example 2 c 1 �� � � - p q � �� �� c 2 p q h B h D 0 0 send M recv M send M recv M h h A C � � � � � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 11 Example 2 [contd.] hi �� �� - p q A C � S �� �� 0 hi h M i �� �� - p q B C � S �� �� 1 hi h M i �� �� - p q B D S � �� �� 2 0 h M i h M i �� �� - p q A D S � �� �� 3 hi � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 12 Prop ert y of the reco rded global state S � S � � S = snapshot � � S is reachable from S � � � S is reachable from S � hi � � �� - p q A D � �� �� 0 h M i � Reco rded global state ( S ) � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 13 Prop ert y of the reco rded global state [Contd.] 0 0 Theorem 1 Ther e exists a c omputation seq = ( e ; 0 � i ) i wher e 0 1. F or al l i , wher e i < � or i � � : e = e , and i i 0 2. the subse quenc e ( e ; � � i < � ) is a p ermutation of the i subse quenc e ( e ; � � i < � ) , and i 0 3. for al l i wher e i � � or i � � : S = S , and i i � 0 4. ther e exists some k ; � � k < � , such that S = S . k � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 14 Colo rful description (due to Dijkstra) � Each machine, atomic action and message is either white o r red � S ) Snapshot (SS) ) S 0 1 white red � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 15 Colo r Assignm ent A tomic Action : same colo r as the machine Message : same colo r as the machine that sends it Snapshot state SSS consists of � state when it made the transition from white to red � the sequence of white messages accepted b y a red machine � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 16 Pro of � Vija c y K. Ga rg Distributed Systems Sp ring 96
Distributed Snapshots 17 Summa ry � Beautiful pap er Beautiful algo rithm � Example of generalization of a p roblem � Vija c y K. Ga rg Distributed Systems Sp ring 96
Recommend
More recommend