confchange_v2_add_single_explicit.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. # Run a V2 membership change that adds a single voter but explicitly asks for the
  2. # use of joint consensus, including wanting to transition out of the joint config
  3. # manually.
  4. # Bootstrap n1.
  5. add-nodes 1 voters=(1) index=2
  6. ----
  7. INFO 1 switched to configuration voters=(1)
  8. INFO 1 became follower at term 0
  9. INFO newRaft 1 [peers: [1], term: 0, commit: 2, applied: 2, lastindex: 2, lastterm: 1]
  10. campaign 1
  11. ----
  12. INFO 1 is starting a new election at term 0
  13. INFO 1 became candidate at term 1
  14. INFO 1 received MsgVoteResp from 1 at term 1
  15. INFO 1 became leader at term 1
  16. # Add v2 with an explicit transition.
  17. propose-conf-change 1 transition=explicit
  18. v2
  19. ----
  20. ok
  21. # Pull n2 out of thin air.
  22. add-nodes 1
  23. ----
  24. INFO 2 switched to configuration voters=()
  25. INFO 2 became follower at term 0
  26. INFO newRaft 2 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
  27. # n1 commits the conf change using itself as commit quorum, then starts catching up n2.
  28. # Everyone remains in the joint config. Note that the snapshot below has AutoLeave unset.
  29. stabilize 1 2
  30. ----
  31. > 1 handling Ready
  32. Ready MustSync=true:
  33. Lead:1 State:StateLeader
  34. HardState Term:1 Vote:1 Commit:4
  35. Entries:
  36. 1/3 EntryNormal ""
  37. 1/4 EntryConfChangeV2 v2
  38. CommittedEntries:
  39. 1/3 EntryNormal ""
  40. 1/4 EntryConfChangeV2 v2
  41. INFO 1 switched to configuration voters=(1 2)&&(1)
  42. > 1 handling Ready
  43. Ready MustSync=false:
  44. Messages:
  45. 1->2 MsgApp Term:1 Log:1/3 Commit:4 Entries:[1/4 EntryConfChangeV2 v2]
  46. > 2 receiving messages
  47. 1->2 MsgApp Term:1 Log:1/3 Commit:4 Entries:[1/4 EntryConfChangeV2 v2]
  48. INFO 2 [term: 0] received a MsgApp message with higher term from 1 [term: 1]
  49. INFO 2 became follower at term 1
  50. DEBUG 2 [logterm: 0, index: 3] rejected MsgApp [logterm: 1, index: 3] from 1
  51. > 2 handling Ready
  52. Ready MustSync=true:
  53. Lead:1 State:StateFollower
  54. HardState Term:1 Commit:0
  55. Messages:
  56. 2->1 MsgAppResp Term:1 Log:0/3 Rejected (Hint: 0)
  57. > 1 receiving messages
  58. 2->1 MsgAppResp Term:1 Log:0/3 Rejected (Hint: 0)
  59. DEBUG 1 received MsgAppResp(MsgApp was rejected, lastindex: 0) from 2 for index 3
  60. DEBUG 1 decreased progress of 2 to [StateProbe match=0 next=1]
  61. DEBUG 1 [firstindex: 3, commit: 4] sent snapshot[index: 4, term: 1] to 2 [StateProbe match=0 next=1]
  62. DEBUG 1 paused sending replication messages to 2 [StateSnapshot match=0 next=1 paused pendingSnap=4]
  63. > 1 handling Ready
  64. Ready MustSync=false:
  65. Messages:
  66. 1->2 MsgSnap Term:1 Log:0/0 Snapshot: Index:4 Term:1 ConfState:Voters:[1 2] VotersOutgoing:[1] Learners:[] LearnersNext:[] AutoLeave:false
  67. > 2 receiving messages
  68. 1->2 MsgSnap Term:1 Log:0/0 Snapshot: Index:4 Term:1 ConfState:Voters:[1 2] VotersOutgoing:[1] Learners:[] LearnersNext:[] AutoLeave:false
  69. INFO log [committed=0, applied=0, unstable.offset=1, len(unstable.Entries)=0] starts to restore snapshot [index: 4, term: 1]
  70. INFO 2 switched to configuration voters=(1 2)&&(1)
  71. INFO 2 [commit: 4, lastindex: 4, lastterm: 1] restored snapshot [index: 4, term: 1]
  72. INFO 2 [commit: 4] restored snapshot [index: 4, term: 1]
  73. > 2 handling Ready
  74. Ready MustSync=false:
  75. HardState Term:1 Commit:4
  76. Snapshot Index:4 Term:1 ConfState:Voters:[1 2] VotersOutgoing:[1] Learners:[] LearnersNext:[] AutoLeave:false
  77. Messages:
  78. 2->1 MsgAppResp Term:1 Log:0/4
  79. > 1 receiving messages
  80. 2->1 MsgAppResp Term:1 Log:0/4
  81. DEBUG 1 recovered from needing snapshot, resumed sending replication messages to 2 [StateSnapshot match=4 next=5 paused pendingSnap=4]
  82. > 1 handling Ready
  83. Ready MustSync=false:
  84. Messages:
  85. 1->2 MsgApp Term:1 Log:1/4 Commit:4
  86. > 2 receiving messages
  87. 1->2 MsgApp Term:1 Log:1/4 Commit:4
  88. > 2 handling Ready
  89. Ready MustSync=false:
  90. Messages:
  91. 2->1 MsgAppResp Term:1 Log:0/4
  92. > 1 receiving messages
  93. 2->1 MsgAppResp Term:1 Log:0/4
  94. # Check that we're not allowed to change membership again while in the joint state.
  95. # This leads to an empty entry being proposed instead (index 5 in the stabilize block
  96. # below).
  97. propose-conf-change 1
  98. v3 v4 v5
  99. ----
  100. INFO 1 ignoring conf change {ConfChangeTransitionAuto [{ConfChangeAddNode 3 []} {ConfChangeAddNode 4 []} {ConfChangeAddNode 5 []}] [] []} at config voters=(1 2)&&(1): must transition out of joint config first
  101. # Propose a transition out of the joint config. We'll see this at index 6 below.
  102. propose-conf-change 1
  103. ----
  104. ok
  105. # The group commits the command and everyone switches to the final config.
  106. stabilize
  107. ----
  108. > 1 handling Ready
  109. Ready MustSync=true:
  110. Entries:
  111. 1/5 EntryNormal ""
  112. 1/6 EntryConfChangeV2
  113. Messages:
  114. 1->2 MsgApp Term:1 Log:1/4 Commit:4 Entries:[1/5 EntryNormal ""]
  115. 1->2 MsgApp Term:1 Log:1/5 Commit:4 Entries:[1/6 EntryConfChangeV2]
  116. > 2 receiving messages
  117. 1->2 MsgApp Term:1 Log:1/4 Commit:4 Entries:[1/5 EntryNormal ""]
  118. 1->2 MsgApp Term:1 Log:1/5 Commit:4 Entries:[1/6 EntryConfChangeV2]
  119. > 2 handling Ready
  120. Ready MustSync=true:
  121. Entries:
  122. 1/5 EntryNormal ""
  123. 1/6 EntryConfChangeV2
  124. Messages:
  125. 2->1 MsgAppResp Term:1 Log:0/5
  126. 2->1 MsgAppResp Term:1 Log:0/6
  127. > 1 receiving messages
  128. 2->1 MsgAppResp Term:1 Log:0/5
  129. 2->1 MsgAppResp Term:1 Log:0/6
  130. > 1 handling Ready
  131. Ready MustSync=false:
  132. HardState Term:1 Vote:1 Commit:6
  133. CommittedEntries:
  134. 1/5 EntryNormal ""
  135. 1/6 EntryConfChangeV2
  136. Messages:
  137. 1->2 MsgApp Term:1 Log:1/6 Commit:5
  138. 1->2 MsgApp Term:1 Log:1/6 Commit:6
  139. INFO 1 switched to configuration voters=(1 2)
  140. > 2 receiving messages
  141. 1->2 MsgApp Term:1 Log:1/6 Commit:5
  142. 1->2 MsgApp Term:1 Log:1/6 Commit:6
  143. > 2 handling Ready
  144. Ready MustSync=false:
  145. HardState Term:1 Commit:6
  146. CommittedEntries:
  147. 1/5 EntryNormal ""
  148. 1/6 EntryConfChangeV2
  149. Messages:
  150. 2->1 MsgAppResp Term:1 Log:0/6
  151. 2->1 MsgAppResp Term:1 Log:0/6
  152. INFO 2 switched to configuration voters=(1 2)
  153. > 1 receiving messages
  154. 2->1 MsgAppResp Term:1 Log:0/6
  155. 2->1 MsgAppResp Term:1 Log:0/6
  156. # Check that trying to transition out again won't do anything.
  157. propose-conf-change 1
  158. ----
  159. INFO 1 ignoring conf change {ConfChangeTransitionAuto [] [] []} at config voters=(1 2): not in joint state; refusing empty conf change
  160. # Finishes work for the empty entry we just proposed.
  161. stabilize
  162. ----
  163. > 1 handling Ready
  164. Ready MustSync=true:
  165. Entries:
  166. 1/7 EntryNormal ""
  167. Messages:
  168. 1->2 MsgApp Term:1 Log:1/6 Commit:6 Entries:[1/7 EntryNormal ""]
  169. > 2 receiving messages
  170. 1->2 MsgApp Term:1 Log:1/6 Commit:6 Entries:[1/7 EntryNormal ""]
  171. > 2 handling Ready
  172. Ready MustSync=true:
  173. Entries:
  174. 1/7 EntryNormal ""
  175. Messages:
  176. 2->1 MsgAppResp Term:1 Log:0/7
  177. > 1 receiving messages
  178. 2->1 MsgAppResp Term:1 Log:0/7
  179. > 1 handling Ready
  180. Ready MustSync=false:
  181. HardState Term:1 Vote:1 Commit:7
  182. CommittedEntries:
  183. 1/7 EntryNormal ""
  184. Messages:
  185. 1->2 MsgApp Term:1 Log:1/7 Commit:7
  186. > 2 receiving messages
  187. 1->2 MsgApp Term:1 Log:1/7 Commit:7
  188. > 2 handling Ready
  189. Ready MustSync=false:
  190. HardState Term:1 Commit:7
  191. CommittedEntries:
  192. 1/7 EntryNormal ""
  193. Messages:
  194. 2->1 MsgAppResp Term:1 Log:0/7
  195. > 1 receiving messages
  196. 2->1 MsgAppResp Term:1 Log:0/7