Debian Codegraph @

raft/quorum/testdata/majority_commit.txt

raw
1 # The empty quorum commits "everything". This is useful for its use in joint
2 # quorums.
3 committed
4 ----
5 <empty majority quorum>∞
6
7
8
9 # A single voter quorum is not final when no index is known.
10 committed cfg=(1) idx=(_)
11 ----
12 idx
13 ? 0 (id=1)
14 0
15
16 # When an index is known, that's the committed index, and that's final.
17 committed cfg=(1) idx=(12)
18 ----
19 idx
20 > 12 (id=1)
21 12
22
23
24
25
26 # With two nodes, start out similarly.
27 committed cfg=(1, 2) idx=(_,_)
28 ----
29 idx
30 ? 0 (id=1)
31 ? 0 (id=2)
32 0
33
34 # The first committed index becomes known (for n1). Nothing changes in the
35 # output because idx=12 is not known to be on a quorum (which is both nodes).
36 committed cfg=(1, 2) idx=(12,_)
37 ----
38 idx
39 x> 12 (id=1)
40 ? 0 (id=2)
41 0
42
43 # The second index comes in and finalize the decision. The result will be the
44 # smaller of the two indexes.
45 committed cfg=(1,2) idx=(12,5)
46 ----
47 idx
48 x> 12 (id=1)
49 > 5 (id=2)
50 5
51
52
53
54
55 # No surprises for three nodes.
56 committed cfg=(1,2,3) idx=(_,_,_)
57 ----
58 idx
59 ? 0 (id=1)
60 ? 0 (id=2)
61 ? 0 (id=3)
62 0
63
64 committed cfg=(1,2,3) idx=(12,_,_)
65 ----
66 idx
67 xx> 12 (id=1)
68 ? 0 (id=2)
69 ? 0 (id=3)
70 0
71
72 # We see a committed index, but a higher committed index for the last pending
73 # votes could change (increment) the outcome, so not final yet.
74 committed cfg=(1,2,3) idx=(12,5,_)
75 ----
76 idx
77 xx> 12 (id=1)
78 x> 5 (id=2)
79 ? 0 (id=3)
80 5
81
82 # a) the case in which it does:
83 committed cfg=(1,2,3) idx=(12,5,6)
84 ----
85 idx
86 xx> 12 (id=1)
87 > 5 (id=2)
88 x> 6 (id=3)
89 6
90
91 # b) the case in which it does not:
92 committed cfg=(1,2,3) idx=(12,5,4)
93 ----
94 idx
95 xx> 12 (id=1)
96 x> 5 (id=2)
97 > 4 (id=3)
98 5
99
100 # c) a different case in which the last index is pending but it has no chance of
101 # swaying the outcome (because nobody in the current quorum agrees on anything
102 # higher than the candidate):
103 committed cfg=(1,2,3) idx=(5,5,_)
104 ----
105 idx
106 x> 5 (id=1)
107 > 5 (id=2)
108 ? 0 (id=3)
109 5
110
111 # c) continued: Doesn't matter what shows up last. The result is final.
112 committed cfg=(1,2,3) idx=(5,5,12)
113 ----
114 idx
115 > 5 (id=1)
116 > 5 (id=2)
117 xx> 12 (id=3)
118 5
119
120 # With all committed idx known, the result is final.
121 committed cfg=(1, 2, 3) idx=(100, 101, 103)
122 ----
123 idx
124 > 100 (id=1)
125 x> 101 (id=2)
126 xx> 103 (id=3)
127 101
128
129
130
131 # Some more complicated examples. Similar to case c) above. The result is
132 # already final because no index higher than 103 is one short of quorum.
133 committed cfg=(1, 2, 3, 4, 5) idx=(101, 104, 103, 103,_)
134 ----
135 idx
136 x> 101 (id=1)
137 xxxx> 104 (id=2)
138 xx> 103 (id=3)
139 > 103 (id=4)
140 ? 0 (id=5)
141 103
142
143 # A similar case which is not final because another vote for >= 103 would change
144 # the outcome.
145 committed cfg=(1, 2, 3, 4, 5) idx=(101, 102, 103, 103,_)
146 ----
147 idx
148 x> 101 (id=1)
149 xx> 102 (id=2)
150 xxx> 103 (id=3)
151 > 103 (id=4)
152 ? 0 (id=5)
153 102