-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replication: prevent boot when rs uuid mismatches
When an instance was being bootstrapped, it didn't check if its replication sources had the same replicaset UUID. As a result, if they didn't match, it used to boot from any of them almost randomly (using selection among non-read-only nodes, and min uuid among these) and raise an error about the mismatching ones later. Obviously, there is something wrong, such replication config is not valid and the node should not boot at all. The patch tries to prevent such instance's bootstrap if it sees at least 2 replicas with different replicaset UUID. It does not solve the problem for all the cases because still one of the replicas simply could be not available. Then the new node would give up and boot from the other node successfully, and notice replicaset UUID mismatch only when the connection to the first node is restored. But it should help for most of the boot attempts. Closes #5613 @TarantoolBot document Title: New field in IPROTO_BALLOT `IPROTO_BALLOT(0x29)` is a response for `IPROTO_VOTE(0x44)`. It used to contain 5 fields (is_ro, vclock, gc_vclock, etc). Now it also contains `IPROTO_BALLOT_REPLICASET_UUID (0x06)`. It is a UUID string showing replicaset UUID of the sender. It can be nil UUID (when all digits are 0) when not known. It is optional. When omitted, it is assumed to be not known.
- Loading branch information
Showing
14 changed files
with
122 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## bugfix/replication | ||
|
||
* Fixed an error when a replica at attempt to boot from instances of different | ||
replicasets (with not the same replicaset UUID) used to boot from one of the | ||
instances and raise an error about the others. Now it won't boot at all if | ||
detects this situation (gh-5613). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
-- test-run result file version 2 | ||
test_run = require('test_run').new() | ||
| --- | ||
| ... | ||
|
||
test_run:cmd('create server master1 with script="replication/gh-5613-master1.lua"') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('start server master1') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('create server master2 with script="replication/gh-5613-master2.lua"') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('start server master2') | ||
| --- | ||
| - true | ||
| ... | ||
|
||
test_run:cmd('create server replica with script="replication/gh-5613-replica.lua"') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('start server replica with crash_expected=True') | ||
| --- | ||
| - false | ||
| ... | ||
opts = {filename = 'gh-5613-replica.log'} | ||
| --- | ||
| ... | ||
assert(test_run:grep_log(nil, 'ER_REPLICASET_UUID_CONFLICT', nil, opts) ~= nil) | ||
| --- | ||
| - true | ||
| ... | ||
|
||
test_run:cmd('stop server master2') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('delete server master2') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('stop server master1') | ||
| --- | ||
| - true | ||
| ... | ||
test_run:cmd('delete server master1') | ||
| --- | ||
| - true | ||
| ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
test_run = require('test_run').new() | ||
|
||
test_run:cmd('create server master1 with script="replication/gh-5613-master1.lua"') | ||
test_run:cmd('start server master1') | ||
test_run:cmd('create server master2 with script="replication/gh-5613-master2.lua"') | ||
test_run:cmd('start server master2') | ||
|
||
test_run:cmd('create server replica with script="replication/gh-5613-replica.lua"') | ||
test_run:cmd('start server replica with crash_expected=True') | ||
opts = {filename = 'gh-5613-replica.log'} | ||
assert(test_run:grep_log(nil, 'ER_REPLICASET_UUID_CONFLICT', nil, opts) ~= nil) | ||
|
||
test_run:cmd('stop server master2') | ||
test_run:cmd('delete server master2') | ||
test_run:cmd('stop server master1') | ||
test_run:cmd('delete server master1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
require('console').listen(os.getenv('ADMIN')) | ||
box.cfg({listen = 'unix/:./master1.sock'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
require('console').listen(os.getenv('ADMIN')) | ||
box.cfg({listen = 'unix/:./master2.sock'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env tarantool | ||
|
||
require('console').listen(os.getenv('ADMIN')) | ||
box.cfg({replication = {'unix/:./master1.sock', 'unix/:./master2.sock'}}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters