]> git.proxmox.com Git - mirror_corosync.git/blame - README.recovery
cfgtool: Simplify output a bit for link status
[mirror_corosync.git] / README.recovery
CommitLineData
3a34cba2
SD
1SYNCHRONIZATION ALGORITHM:
2-------------------------
dd3991c0 3The synchronization algorithm is used for every service in corosync to
62148d10 4synchronize state of the system.
3a34cba2
SD
5
6There are 4 events of the synchronization algorithm. These events are in fact
7functions that are registered in the service handler data structure. They
8are called by the synchronization system whenever a network partitions or
9merges.
10
11init:
12Within the init event a service handler should record temporary state variables
13used by the process event.
14
15process:
16The process event is responsible for executing synchronization. This event
17will return a state as to whether it has completed or not. This allows for
18synchronization to be interrupted and recontinue when the message queue buffer
19is full. The process event will be called again by the synchronization service
4ebb7ad0 20if requested to do so by the return variable returned in process.
3a34cba2
SD
21
22abort:
23The abort event occurs when during synchronization a processor failure occurs.
24
25activate:
26The activate event occurs when process has returned no more processing is
27necessary for any node in the cluster and all messages originated by process
28have completed.
29
30CHECKPOINT SYNCHRONIZATION ALGORITHM:
31------------------------------------
4ebb7ad0
MS
32The purpose of the checkpoint synchronization algorithm is to synchronize
33checkpoints after a partition or merge of two or more partitions. The
3a34cba2
SD
34secondary purpose of the algorithm is to determine the cluster-wide reference
35count for every checkpoint.
36
37Every cluster contains a group of checkpoints. Each checkpoint has a
38checkpoint name and checkpoint number. The number is used to uniquely reference
4ebb7ad0 39an unlinked but still open checkpoint in the cluster.
3a34cba2
SD
40
41Every checkpoint contains a reference count which is used to determine when
42that checkpoint may be released. The algorithm rebuilds the reference count
43information each time a partition or merge occurs.
44
45local variables
46my_sync_state may have the values SYNC_CHECKPOINT, SYNC_REFCOUNT
47my_current_iteration_state contains any data used to iterate the checkpoints
48 and sections.
49checkpoint data
50 refcount_set contains reference count for every node consisting of
51 number of opened connections to checkpoint and node identifier
52 refcount contains a summation of every reference count in the refcount_set
53
4ebb7ad0 54pseudocode executed by a processor when the synchronization service calls
3a34cba2
SD
55the init event
56 call process_checkpoints_enter
57
58pseudocode executed by a processor when the synchronization service calls
59the process event in the SYNC_CHECKPOINT state
60 if lowest processor identifier of old ring in new ring
61 transmit checkpoints or sections starting from my_current_iteration_state
62 if all checkpoints and sections could be queued
63 call sync_refcounts_enter
64 else
65 record my_current_iteration_state
66
67 require process to continue
68
69pseudocode executed by a processor when the synchronization service calls
70the process event in the SYNC_REFCOUNT state
71 if lowest processor identifier of old ring in new ring
72 transmit checkpoint reference counts
73 if all checkpoint reference counts could be queued
74 require process to not continue
75 else
76 record my_current_iteration_state for checkpoint reference counts
77
78sync_checkpoints_enter:
79 my_sync_state = SYNC_CHECKPOINT
4ebb7ad0 80 my_current_iteration_state set to start of checkpoint list
3a34cba2
SD
81
82sync_refcounts_enter:
83 my_sync_state = SYNC_REFCOUNT
84
85on event receipt of foreign ring id message
86 ignore message
87
88pseudocode executed on event receipt of checkpoint update
89 if checkpoint exists in temporary storage
90 ignore message
91 else
92 create checkpoint
93 reset checkpoint refcount array
904a10ed 94
3a34cba2
SD
95pseudocode executed on event receipt of checkpoint section update
96 if checkpoint section exists in temporary storage
97 ignore message
98 else
99 create checkpoint section
100
101pseudocode executed on event receipt of reference count update
102 update temporary checkpoint data storage reference count set by adding
103 any reference counts in the temporary message set to those from the
104 event
105 update that checkpoint's reference count
106 set the global checkpoint id to the current checkpoint id + 1 if it
107 would increase the global checkpoint id
108
109pseudocode called when the synchronization service calls the activate event:
110for all checkpoints
111 free all previously committed checkpoints and sections
112 convert temporary checkpoints and sections to regular sections
113copy my_saved_ring_id to my_old_ring_id
114
115pseudocode called when the synchronization service calls the abort event:
116 free all temporary checkpoints and temporary sections