[Tarantool-patches] [PATCH v2 04/10] replication: track registered replica count
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Tue Sep 8 01:54:51 MSK 2020
Hi! Thanks for the review!
>> diff --git a/src/box/replication.cc b/src/box/replication.cc
>> index ef0e2411d..20f16206a 100644
>> --- a/src/box/replication.cc
>> +++ b/src/box/replication.cc
>> @@ -247,6 +247,7 @@ replica_set_id(struct replica *replica, uint32_t replica_id)
>> tt_uuid_str(&replica->uuid));
>> }
>> replicaset.replica_by_id[replica_id] = replica;
>> + ++replicaset.size;
>
> There's another use of the replica_set_id() inside the register_replica()
> of alter.cc. Apparently, it's just for re-assign the ID without adding of
> a new node. I would propose to move this counter into replicaset_add()
A replica can become anon, and can be deleted. So I can't manage the counter
only in replicaset_add. It should decrease somewhere.
Talking of alter.cc, instance ID is a primary key of _cluster. So it can't be
changed for an existing replica. It needs to be deleted and added with a new
ID. It means, instance ID is essentially a read-only field.
Also this is validated in replica_set_id() - it checks the replica wasn't
registered before in an assertion - and in replica_clear_id() - it checks the
replica is registered. There are no cases, when an ID is updated for an existing
replica.
More information about the Tarantool-patches
mailing list