Skip to content
Snippets Groups Projects
Commit 6f038f4b authored by Ilya Kosarev's avatar Ilya Kosarev Committed by Kirill Yukhin
Browse files

replication: make anon replicas iteration safe

In replicaset_follow we iterate anon replicas list: list of replicas
that haven't received an UUID. In case of successful connect replica
link is being removed from anon list. If it happens immediately,
without yield in applier, iteration breaks. Now it is fixed by
rlist_foreach_entry_safe instead of common rlist_foreach_entry.
Relevant test case is added.

Part of #4586
Closes #4576
Closes #4440
parent 36ff3c89
No related branches found
No related tags found
No related merge requests found
......@@ -802,7 +802,8 @@ replicaset_follow(void)
if (replica->applier != NULL)
applier_resume(replica->applier);
}
rlist_foreach_entry(replica, &replicaset.anon, in_anon) {
struct replica *tmp;
rlist_foreach_entry_safe(replica, &replicaset.anon, in_anon, tmp) {
/* Restart appliers that failed to connect. */
applier_start(replica->applier);
}
......
-- test-run result file version 2
test_run = require('test_run').new()
| ---
| ...
SERVERS = {'master_quorum1', 'master_quorum2'}
| ---
| ...
-- Deploy a cluster.
test_run:create_cluster(SERVERS)
| ---
| ...
test_run:wait_fullmesh(SERVERS)
| ---
| ...
test_run:cmd("switch master_quorum1")
| ---
| - true
| ...
repl = box.cfg.replication
| ---
| ...
for i = 1, 1000 do \
box.cfg{replication = ""} \
box.cfg{replication = repl} \
end
| ---
| ...
test_run:cmd("switch default")
| ---
| - true
| ...
-- Cleanup.
test_run:drop_cluster(SERVERS)
| ---
| ...
test_run = require('test_run').new()
SERVERS = {'master_quorum1', 'master_quorum2'}
-- Deploy a cluster.
test_run:create_cluster(SERVERS)
test_run:wait_fullmesh(SERVERS)
test_run:cmd("switch master_quorum1")
repl = box.cfg.replication
for i = 1, 1000 do \
box.cfg{replication = ""} \
box.cfg{replication = repl} \
end
test_run:cmd("switch default")
-- Cleanup.
test_run:drop_cluster(SERVERS)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment