From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 5D0EE45256A for ; Mon, 18 Nov 2019 16:19:51 +0300 (MSK) From: Ilya Kosarev Date: Mon, 18 Nov 2019 16:19:42 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH 1/2] replication: make anon replicas iteration safe List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org 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. Part of #4586 --- src/box/replication.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/box/replication.cc b/src/box/replication.cc index 509187cd3..495a01c4f 100644 --- a/src/box/replication.cc +++ b/src/box/replication.cc @@ -800,7 +800,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); } -- 2.17.1