Skip to content

Instantly share code, notes, and snippets.

@tbg
Created July 17, 2019 22:46
Show Gist options
  • Save tbg/90706dc3a2df4cd2e90e6e2962e194b8 to your computer and use it in GitHub Desktop.
Save tbg/90706dc3a2df4cd2e90e6e2962e194b8 to your computer and use it in GitHub Desktop.
add-nodes 2 voters=(1,2,3)
----
INFO 1 switched to configuration voters=(1)
INFO 1 switched to configuration voters=(1 2)
INFO 1 switched to configuration voters=(1 2 3)
INFO 1 became follower at term 0
INFO newRaft 1 [peers: [1,2,3], term: 0, commit: 2, applied: 2, lastindex: 2, lastterm: 1]
INFO 2 switched to configuration voters=(1)
INFO 2 switched to configuration voters=(1 2)
INFO 2 switched to configuration voters=(1 2 3)
INFO 2 became follower at term 0
INFO newRaft 2 [peers: [1,2,3], term: 0, commit: 2, applied: 2, lastindex: 2, lastterm: 1]
campaign 1
----
INFO 1 is starting a new election at term 0
INFO 1 became candidate at term 1
INFO 1 received MsgVoteResp from 1 at term 1
INFO 1 [logterm: 1, index: 2] sent MsgVote request to 2 at term 1
INFO 1 [logterm: 1, index: 2] sent MsgVote request to 3 at term 1
stabilize
----
> 1 handling Ready
Ready MustSync=true:
Lead:0 State:StateCandidate
HardState Term:1 Vote:1 Commit:2
Messages:
1->2 MsgVote Term:1 Log:1/2
1->3 MsgVote Term:1 Log:1/2
> delivering messages
1->2 MsgVote Term:1 Log:1/2
INFO 2 [term: 0] received a MsgVote message with higher term from 1 [term: 1]
INFO 2 became follower at term 1
INFO 2 [logterm: 1, index: 2, vote: 0] cast MsgVote for 1 [logterm: 1, index: 2] at term 1
> 2 handling Ready
Ready MustSync=true:
HardState Term:1 Vote:1 Commit:2
Messages:
2->1 MsgVoteResp Term:1 Log:0/0
> delivering messages
2->1 MsgVoteResp Term:1 Log:0/0
INFO 1 received MsgVoteResp from 2 at term 1
INFO 1 has received 2 MsgVoteResp votes and 0 vote rejections
INFO 1 became leader at term 1
> 1 handling Ready
Ready MustSync=true:
Lead:1 State:StateLeader
Entries:
1/3 EntryNormal (0 bytes)
Messages:
1->2 MsgApp Term:1 Log:1/2 Commit:2 Entries:[1/3 EntryNormal (0 bytes)]
1->3 MsgApp Term:1 Log:1/2 Commit:2 Entries:[1/3 EntryNormal (0 bytes)]
> delivering messages
1->2 MsgApp Term:1 Log:1/2 Commit:2 Entries:[1/3 EntryNormal (0 bytes)]
> 2 handling Ready
Ready MustSync=true:
Lead:1 State:StateFollower
Entries:
1/3 EntryNormal (0 bytes)
Messages:
2->1 MsgAppResp Term:1 Log:0/3
> delivering messages
2->1 MsgAppResp Term:1 Log:0/3
> 1 handling Ready
Ready MustSync=false:
HardState Term:1 Vote:1 Commit:3
CommittedEntries:
1/3 EntryNormal (0 bytes)
Messages:
1->2 MsgApp Term:1 Log:1/3 Commit:3
> delivering messages
1->2 MsgApp Term:1 Log:1/3 Commit:3
> 2 handling Ready
Ready MustSync=false:
HardState Term:1 Vote:1 Commit:3
CommittedEntries:
1/3 EntryNormal (0 bytes)
Messages:
2->1 MsgAppResp Term:1 Log:0/3
> delivering messages
2->1 MsgAppResp Term:1 Log:0/3
log 1
----
1/3 EntryNormal (0 bytes)
add-nodes 1
----
INFO 3 became follower at term 0
INFO newRaft 3 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
INFO 3 became follower at term 1
tick-heartbeat 1
----
ok
handle-ready 1
----
Ready MustSync=false:
Messages:
1->2 MsgHeartbeat Term:1 Log:0/0 Commit:3
1->3 MsgHeartbeat Term:1 Log:0/0
stabilize 3
----
> 3 handling Ready
Ready MustSync=true:
HardState Term:1 Commit:0
> delivering messages
1->3 MsgVote Term:1 Log:1/2
INFO 3 [logterm: 0, index: 0, vote: 0] cast MsgVote for 1 [logterm: 1, index: 2] at term 1
1->3 MsgApp Term:1 Log:1/2 Commit:2 Entries:[1/3 EntryNormal (0 bytes)]
DEBUG 3 [logterm: 0, index: 2] rejected msgApp [logterm: 1, index: 2] from 1
1->3 MsgHeartbeat Term:1 Log:0/0
> 3 handling Ready
Ready MustSync=true:
Lead:1 State:StateFollower
HardState Term:1 Vote:1 Commit:0
Messages:
3->1 MsgVoteResp Term:1 Log:0/0
3->1 MsgAppResp Term:1 Log:0/2 Rejected (Hint: 0)
3->1 MsgHeartbeatResp Term:1 Log:0/0
stabilize 1
----
> delivering messages
3->1 MsgVoteResp Term:1 Log:0/0
3->1 MsgAppResp Term:1 Log:0/2 Rejected (Hint: 0)
DEBUG 1 received msgApp rejection(lastindex: 0) from 3 for index 2
DEBUG 1 decreased progress of 3 to [StateProbe match=0 next=1]
DEBUG 1 [firstindex: 3, commit: 3] sent snapshot[index: 2, term: 1] to 3 [StateProbe match=0 next=1]
DEBUG 1 paused sending replication messages to 3 [StateSnapshot match=0 next=1 paused pendingSnap=2]
3->1 MsgHeartbeatResp Term:1 Log:0/0
> 1 handling Ready
Ready MustSync=false:
Messages:
1->3 MsgSnap Term:1 Log:0/0 Snapshot:{[] {{[1 2 3] [] [] <nil> []} 2 1 []} []}
stabilize 3
----
> delivering messages
1->3 MsgSnap Term:1 Log:0/0 Snapshot:{[] {{[1 2 3] [] [] <nil> []} 2 1 []} []}
INFO log [committed=0, applied=0, unstable.offset=1, len(unstable.Entries)=0] starts to restore snapshot [index: 2, term: 1]
INFO 3 switched to configuration voters=(1)
INFO 3 switched to configuration voters=(1 2)
INFO 3 switched to configuration voters=(1 2 3)
INFO 3 [commit: 2, lastindex: 2, lastterm: 1] restored snapshot [index: 2, term: 1]
INFO 3 [commit: 2] restored snapshot [index: 2, term: 1]
> 3 handling Ready
Ready MustSync=false:
HardState Term:1 Vote:1 Commit:2
Snapshot Index:2 Term:1 ConfState:Voters:[1 2 3] VotersJoint:[] Learners:[]
Messages:
3->1 MsgAppResp Term:1 Log:0/2
stabilize 1
----
> delivering messages
3->1 MsgAppResp Term:1 Log:0/2
DEBUG 1 recovered from needing snapshot, resumed sending replication messages to 3 [StateSnapshot match=2 next=3 paused pendingSnap=2]
> 1 handling Ready
Ready MustSync=false:
Messages:
1->3 MsgApp Term:1 Log:1/2 Commit:3 Entries:[1/3 EntryNormal (0 bytes)]
stabilize
----
ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment