[Tarantool-patches] [PATCH v2 3/4] replication: add is_anon flag to ballot

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Sep 16 00:22:40 MSK 2020


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);
 	}
 }


More information about the Tarantool-patches mailing list