replication: prefer to join from booted replicas
The algorithm of looking for an instance to join the replicaset from didn't take into account that some of the instances might be not bootstrapped but still perfectly available. As a result, a ridiculous situation could happen - an instance could connect to a cluster with just read-only instances, but it could have itself with box.cfg{read_only = false}. Then instead of failing or waiting it just booted a brand new cluster. And after that the node just started complaining about the others having a different replicaset UUID. The patch makes so a new instance always prefers a bootstrapped join-source to a non-boostrapped one, including self. In the situation above the new instance now terminates with an error. In future hopefully it should start a retry-loop instead. Closes #5613 @TarantoolBot document Title: IPROTO_BALLOT rework and a new field A couple of fields in `IPROTO_BALLOT 0x29` used to have values not matching with their names. They are changed. * `IPROTO_BALLOT_IS_RO 0x01` used to mean "the instance has `box.cfg{read_only = true}`". It was renamed in the source code to `IPROTO_BALLOT_IS_RO_CFG`. It has the same code `0x01`, and the value is the same. Only the name has changed, and in the doc should be too. * `IPROTO_BALLOT_IS_LOADING 0x04` used to mean "the instance has finished `box.cfg()` and it has `read_only = true`". The name was wrong therefore, because even if the instance finished loading, the flag still was false for `read_only = true` nodes. Also such a value is not very suitable for any sane usage. The name was changed to `IPROTO_BALLOT_IS_RO`, the code stayed the same, and the value now is "the instance is not writable". The reason for being not writable can be any: the node is an orphan; or it has `read_only = true`; or it is a Raft follower; or anything else. And there is a new field. `IPROTO_BALLOT_IS_BOOTED 0x06` means the instance has finished its bootstrap or recovery.
Showing
- changelogs/unreleased/gh-5613-bootstrap-prefer-booted.md 6 additions, 0 deletionschangelogs/unreleased/gh-5613-bootstrap-prefer-booted.md
- src/box/replication.cc 11 additions, 9 deletionssrc/box/replication.cc
- test/replication/gh-5613-bootstrap-prefer-booted.result 78 additions, 0 deletionstest/replication/gh-5613-bootstrap-prefer-booted.result
- test/replication/gh-5613-bootstrap-prefer-booted.test.lua 29 additions, 0 deletionstest/replication/gh-5613-bootstrap-prefer-booted.test.lua
- test/replication/gh-5613-master.lua 11 additions, 0 deletionstest/replication/gh-5613-master.lua
- test/replication/gh-5613-replica1.lua 13 additions, 0 deletionstest/replication/gh-5613-replica1.lua
- test/replication/gh-5613-replica2.lua 11 additions, 0 deletionstest/replication/gh-5613-replica2.lua
- test/replication/suite.cfg 1 addition, 0 deletionstest/replication/suite.cfg
Loading
Please register or sign in to comment