[Tarantool-patches] [PATCH 1/1] replication: check rs uuid on subscribe process

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat May 29 01:20:46 MSK 2021


On 29.05.2021 00:06, Cyrill Gorcunov wrote:
> On Fri, May 28, 2021 at 10:35:42PM +0200, Vladislav Shpilevoy wrote:
>> +	if (!tt_uuid_is_equal(&peer_replicaset_uuid, &REPLICASET_UUID)) {
>> +		tnt_raise(ClientError, ER_REPLICASET_UUID_MISMATCH,
>> +			  tt_uuid_str(&REPLICASET_UUID),
>> +			  tt_uuid_str(&peer_replicaset_uuid));
>> +	}
> 
> Vlad, I didn't dive into the patch context yet but this
> use of *two* sequential calls of tt_uuid_str() is somehow
> suspicious. The tt_uuid_str uses single common buffer
> for any call which means some of tt_uuid_str() result
> will be overwritten, no?

Nope, the static buffer is cyclic. Each tt_uuid_str()
call uses only a part of it. In total it is safe to
make ~12 tt_uuid_str() calls in a row. Because the
static buffer size is 12KB, and one tt_uuid_str()
wastes 1KB (which is not necessary, it could be much
more compact).


More information about the Tarantool-patches mailing list