[Tarantool-patches] [PATCH v2 2/4] replication: fix appliers pruning

Ilya Kosarev i.kosarev at tarantool.org
Sun Nov 24 00:53:56 MSK 2019


During pruning of replicaset appliers some anon replicas might connect
from replicaset_follow called in another fiber. Therefore we need to
prune appliers of anon replicas first.

Closes #4643
---
 src/box/replication.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/box/replication.cc b/src/box/replication.cc
index 509187cd3..3ccfa8b33 100644
--- a/src/box/replication.cc
+++ b/src/box/replication.cc
@@ -516,23 +516,23 @@ replicaset_update(struct applier **appliers, int count)
 	 */
 
 	/* Prune old appliers */
-	replicaset_foreach(replica) {
-		if (replica->applier == NULL)
-			continue;
+	rlist_foreach_entry_safe(replica, &replicaset.anon, in_anon, next) {
 		applier = replica->applier;
 		replica_clear_applier(replica);
-		replica->applier_sync_state = APPLIER_DISCONNECTED;
+		replica_delete(replica);
 		applier_stop(applier);
 		applier_delete(applier);
 	}
-	rlist_foreach_entry_safe(replica, &replicaset.anon, in_anon, next) {
+	rlist_create(&replicaset.anon);
+	replicaset_foreach(replica) {
+		if (replica->applier == NULL)
+			continue;
 		applier = replica->applier;
 		replica_clear_applier(replica);
-		replica_delete(replica);
+		replica->applier_sync_state = APPLIER_DISCONNECTED;
 		applier_stop(applier);
 		applier_delete(applier);
 	}
-	rlist_create(&replicaset.anon);
 
 	/* Save new appliers */
 	replicaset.applier.total = count;
-- 
2.17.1



More information about the Tarantool-patches mailing list