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