README.recovery 4.4 KB

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