From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 211B1469719 for ; Wed, 16 Sep 2020 00:22:42 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: Date: Tue, 15 Sep 2020 23:22:40 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH v2 3/4] replication: add is_anon flag to ballot List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko , tarantool-patches@dev.tarantool.org, gorcunov@gmail.com Thanks for the review! >> diff --git a/src/box/replication.cc b/src/box/replication.cc >> index ef0e2411d..8408f395e 100644 >> --- a/src/box/replication.cc >> +++ b/src/box/replication.cc >> @@ -290,6 +290,8 @@ replica_clear_id(struct replica *replica) >>       } >>       if (replica_is_orphan(replica)) { >>           replica_hash_remove(&replicaset.hash, replica); >> +        replicaset.anon_count -= replica->anon; >> +        assert(replicaset.anon_count >= 0); > > replica_clear_id() is only called on _cluster entry deletion. > So you're surely working with a normal replica, not anonymous. > > We may add an assset(!replica->anon) somewhere. Indeed: ==================== diff --git a/src/box/replication.cc b/src/box/replication.cc index 8408f395e..c1fcdb660 100644 --- a/src/box/replication.cc +++ b/src/box/replication.cc @@ -290,8 +290,11 @@ replica_clear_id(struct replica *replica) } if (replica_is_orphan(replica)) { replica_hash_remove(&replicaset.hash, replica); - replicaset.anon_count -= replica->anon; - assert(replicaset.anon_count >= 0); + /* + * The replica had an ID, it couldn't be anon by + * definition. + */ + assert(!replica->anon); replica_delete(replica); } }