Commit 3a7dde7
committed
NRG: Disjoint majorities during membership changes and network partitions
This commit fixes the following bugs:
- Inconsistent Cluster Size: When a leader was partitioned from the
cluster, immediately after proposing a EntryAddPeer. The remaining
nodes could end up with different view of the cluster size and
quorum. So followers could have cluster size and would not match
the number of peers in the peer set. A subsequent leader election,
electing one of the followers, could break the quorum system.
- Incorrect Leader Election: It was possible for a new leader to be
elected without a proper quorum. This could happen if a partition
occurred after a new peer was proposed but before that change was
committed. A follower could add the uncommitted peer to its peer
set but would not update its cluster size and quorum, leading to
an invalid election.
Both issues are solved by making sure that when a peer is added or
removed from the membership, the cluster size and quorum are adjusted
accordingly, at the same time. Followers would first add peers when
receiving the EntryAddPeer, and then adjusting the cluster size
only after commit. This patch changes this behavior such that the
cluster size and quorum are recomputed upon receiving the EntryAddPeer
/ EntryRemovePeer proposals. This is inline with the membership
protocol proposed in Ongaro's dissertation, section 4.1.
This patch also removes the concept of a "known" peer from the Raft
layer. A node would add a peer to its peer set when first receiving
the corresponding appendEntry, and on commit it would be marked as
"known". This distinction no longer applies.
Signed-off-by: Daniele Sciascia <[email protected]>1 parent 36aa6b7 commit 3a7dde7
4 files changed
+227
-73
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4190 | 4190 | | |
4191 | 4191 | | |
4192 | 4192 | | |
4193 | | - | |
4194 | 4193 | | |
| 4194 | + | |
| 4195 | + | |
| 4196 | + | |
4195 | 4197 | | |
4196 | 4198 | | |
4197 | 4199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | 256 | | |
258 | 257 | | |
259 | 258 | | |
| |||
543 | 542 | | |
544 | 543 | | |
545 | 544 | | |
546 | | - | |
| 545 | + | |
547 | 546 | | |
548 | 547 | | |
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
552 | | - | |
| 551 | + | |
553 | 552 | | |
554 | 553 | | |
555 | 554 | | |
| |||
2624 | 2623 | | |
2625 | 2624 | | |
2626 | 2625 | | |
2627 | | - | |
| 2626 | + | |
2628 | 2627 | | |
2629 | 2628 | | |
2630 | | - | |
2631 | | - | |
2632 | | - | |
2633 | | - | |
| 2629 | + | |
2634 | 2630 | | |
2635 | 2631 | | |
2636 | 2632 | | |
| |||
2917 | 2913 | | |
2918 | 2914 | | |
2919 | 2915 | | |
2920 | | - | |
2921 | | - | |
2922 | 2916 | | |
2923 | | - | |
2924 | | - | |
2925 | | - | |
2926 | | - | |
2927 | 2917 | | |
2928 | 2918 | | |
2929 | 2919 | | |
| |||
3188 | 3178 | | |
3189 | 3179 | | |
3190 | 3180 | | |
3191 | | - | |
3192 | | - | |
3193 | | - | |
3194 | | - | |
3195 | | - | |
3196 | | - | |
3197 | 3181 | | |
3198 | | - | |
3199 | | - | |
3200 | | - | |
3201 | | - | |
3202 | | - | |
3203 | | - | |
3204 | | - | |
3205 | | - | |
3206 | 3182 | | |
3207 | 3183 | | |
3208 | 3184 | | |
3209 | 3185 | | |
3210 | 3186 | | |
3211 | | - | |
3212 | 3187 | | |
3213 | 3188 | | |
3214 | 3189 | | |
3215 | 3190 | | |
3216 | | - | |
3217 | | - | |
3218 | | - | |
3219 | | - | |
3220 | | - | |
3221 | 3191 | | |
3222 | 3192 | | |
3223 | 3193 | | |
| |||
3305 | 3275 | | |
3306 | 3276 | | |
3307 | 3277 | | |
3308 | | - | |
3309 | | - | |
3310 | | - | |
3311 | | - | |
3312 | | - | |
3313 | | - | |
3314 | | - | |
| 3278 | + | |
| 3279 | + | |
3315 | 3280 | | |
3316 | 3281 | | |
3317 | | - | |
3318 | | - | |
| 3282 | + | |
| 3283 | + | |
3319 | 3284 | | |
3320 | | - | |
3321 | | - | |
| 3285 | + | |
| 3286 | + | |
3322 | 3287 | | |
3323 | 3288 | | |
3324 | 3289 | | |
3325 | 3290 | | |
3326 | | - | |
| 3291 | + | |
3327 | 3292 | | |
3328 | 3293 | | |
3329 | 3294 | | |
| |||
3341 | 3306 | | |
3342 | 3307 | | |
3343 | 3308 | | |
3344 | | - | |
| 3309 | + | |
3345 | 3310 | | |
3346 | 3311 | | |
3347 | 3312 | | |
| |||
3936 | 3901 | | |
3937 | 3902 | | |
3938 | 3903 | | |
3939 | | - | |
3940 | | - | |
3941 | | - | |
3942 | | - | |
3943 | | - | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
3944 | 3908 | | |
3945 | | - | |
3946 | | - | |
3947 | 3909 | | |
| 3910 | + | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
3948 | 3922 | | |
3949 | 3923 | | |
3950 | 3924 | | |
| |||
4006 | 3980 | | |
4007 | 3981 | | |
4008 | 3982 | | |
4009 | | - | |
4010 | 3983 | | |
4011 | 3984 | | |
4012 | | - | |
| 3985 | + | |
4013 | 3986 | | |
4014 | 3987 | | |
4015 | 3988 | | |
| |||
4251 | 4224 | | |
4252 | 4225 | | |
4253 | 4226 | | |
4254 | | - | |
4255 | | - | |
4256 | | - | |
4257 | | - | |
| 4227 | + | |
| 4228 | + | |
4258 | 4229 | | |
4259 | 4230 | | |
4260 | 4231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
0 commit comments