campaign_learner_must_vote.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. # Regression test that verifies that learners can vote. This holds only in the
  2. # sense that if a learner is asked to vote, a candidate believes that they are a
  3. # voter based on its current config, which may be more recent than that of the
  4. # learner. If learners which are actually voters but don't know it yet don't
  5. # vote in that situation, the raft group may end up unavailable despite a quorum
  6. # of voters (as of the latest config) being available.
  7. #
  8. # See:
  9. # https://github.com/etcd-io/etcd/pull/10998
  10. # Turn output off during boilerplate.
  11. log-level none
  12. ----
  13. ok
  14. # Bootstrap three nodes.
  15. add-nodes 3 voters=(1,2) learners=(3) index=2
  16. ----
  17. ok
  18. # n1 gets to be leader.
  19. campaign 1
  20. ----
  21. ok
  22. stabilize
  23. ----
  24. ok (quiet)
  25. # Propose a conf change on n1 that promotes n3 to voter.
  26. propose-conf-change 1
  27. v3
  28. ----
  29. ok
  30. # Commit and fully apply said conf change. n1 and n2 now consider n3 a voter.
  31. stabilize 1 2
  32. ----
  33. ok (quiet)
  34. # Drop all inflight messages to 3. We don't want it to be caught up when it is
  35. # asked to vote.
  36. deliver-msgs drop=(3)
  37. ----
  38. ok (quiet)
  39. # We now pretend that n1 is dead, and n2 is trying to become leader.
  40. log-level debug
  41. ----
  42. ok
  43. campaign 2
  44. ----
  45. INFO 2 is starting a new election at term 1
  46. INFO 2 became candidate at term 2
  47. INFO 2 received MsgVoteResp from 2 at term 2
  48. INFO 2 [logterm: 1, index: 4] sent MsgVote request to 1 at term 2
  49. INFO 2 [logterm: 1, index: 4] sent MsgVote request to 3 at term 2
  50. # Send out the MsgVote requests.
  51. process-ready 2
  52. ----
  53. Ready MustSync=true:
  54. Lead:0 State:StateCandidate
  55. HardState Term:2 Vote:2 Commit:4
  56. Messages:
  57. 2->1 MsgVote Term:2 Log:1/4
  58. 2->3 MsgVote Term:2 Log:1/4
  59. # n2 is now campaigning while n1 is down (does not respond). The latest config
  60. # has n3 as a voter, but n3 doesn't even have the corresponding conf change in
  61. # its log. Still, it casts a vote for n2 which can in turn become leader and
  62. # catches up n3.
  63. stabilize 3
  64. ----
  65. > 3 receiving messages
  66. 2->3 MsgVote Term:2 Log:1/4
  67. INFO 3 [term: 1] received a MsgVote message with higher term from 2 [term: 2]
  68. INFO 3 became follower at term 2
  69. INFO 3 [logterm: 1, index: 3, vote: 0] cast MsgVote for 2 [logterm: 1, index: 4] at term 2
  70. > 3 handling Ready
  71. Ready MustSync=true:
  72. Lead:0 State:StateFollower
  73. HardState Term:2 Vote:2 Commit:3
  74. Messages:
  75. 3->2 MsgVoteResp Term:2 Log:0/0
  76. stabilize 2 3
  77. ----
  78. > 2 receiving messages
  79. 3->2 MsgVoteResp Term:2 Log:0/0
  80. INFO 2 received MsgVoteResp from 3 at term 2
  81. INFO 2 has received 2 MsgVoteResp votes and 0 vote rejections
  82. INFO 2 became leader at term 2
  83. > 2 handling Ready
  84. Ready MustSync=true:
  85. Lead:2 State:StateLeader
  86. Entries:
  87. 2/5 EntryNormal ""
  88. Messages:
  89. 2->1 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""]
  90. 2->3 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""]
  91. > 3 receiving messages
  92. 2->3 MsgApp Term:2 Log:1/4 Commit:4 Entries:[2/5 EntryNormal ""]
  93. DEBUG 3 [logterm: 0, index: 4] rejected MsgApp [logterm: 1, index: 4] from 2
  94. > 3 handling Ready
  95. Ready MustSync=false:
  96. Lead:2 State:StateFollower
  97. Messages:
  98. 3->2 MsgAppResp Term:2 Log:0/4 Rejected (Hint: 3)
  99. > 2 receiving messages
  100. 3->2 MsgAppResp Term:2 Log:0/4 Rejected (Hint: 3)
  101. DEBUG 2 received MsgAppResp(MsgApp was rejected, lastindex: 3) from 3 for index 4
  102. DEBUG 2 decreased progress of 3 to [StateProbe match=0 next=4]
  103. > 2 handling Ready
  104. Ready MustSync=false:
  105. Messages:
  106. 2->3 MsgApp Term:2 Log:1/3 Commit:4 Entries:[1/4 EntryConfChangeV2 v3, 2/5 EntryNormal ""]
  107. > 3 receiving messages
  108. 2->3 MsgApp Term:2 Log:1/3 Commit:4 Entries:[1/4 EntryConfChangeV2 v3, 2/5 EntryNormal ""]
  109. > 3 handling Ready
  110. Ready MustSync=true:
  111. HardState Term:2 Vote:2 Commit:4
  112. Entries:
  113. 1/4 EntryConfChangeV2 v3
  114. 2/5 EntryNormal ""
  115. CommittedEntries:
  116. 1/4 EntryConfChangeV2 v3
  117. Messages:
  118. 3->2 MsgAppResp Term:2 Log:0/5
  119. INFO 3 switched to configuration voters=(1 2 3)
  120. > 2 receiving messages
  121. 3->2 MsgAppResp Term:2 Log:0/5
  122. > 2 handling Ready
  123. Ready MustSync=false:
  124. HardState Term:2 Vote:2 Commit:5
  125. CommittedEntries:
  126. 2/5 EntryNormal ""
  127. Messages:
  128. 2->3 MsgApp Term:2 Log:2/5 Commit:5
  129. > 3 receiving messages
  130. 2->3 MsgApp Term:2 Log:2/5 Commit:5
  131. > 3 handling Ready
  132. Ready MustSync=false:
  133. HardState Term:2 Vote:2 Commit:5
  134. CommittedEntries:
  135. 2/5 EntryNormal ""
  136. Messages:
  137. 3->2 MsgAppResp Term:2 Log:0/5
  138. > 2 receiving messages
  139. 3->2 MsgAppResp Term:2 Log:0/5