>>> +relay_final_join(io->fd, header->sync, &start_vclock, &stop_vclock);
>>> +say_info("final data sent.");
>>> +
>>> +struct xrow_header row;
>>> +/* Send end of WAL stream marker */
>>> +xrow_encode_vclock_xc(&row, &replicaset.vclock);
>>> +row.sync = header->sync;
>>> +coio_write_xrow(io, &row);
>>> +
>>> +/*
>>> + * Advance the WAL consumer state to the position where
>>> + * FINAL JOIN ended and assign it to the replica.
>>> + */
>>> +gc_consumer_advance(gc, &stop_vclock);
>>> +replica = replica_by_uuid(&instance_uuid);
>>> +if (replica->gc != NULL)
>>> +gc_consumer_unregister(replica->gc);
>>
>> 9. How is that possible that the former anon replica has gc?
>
> Anon replica receives a gc registration in replica_set_id, which is called
> above.
I missed that, thanks. Then it looks ok.
>>> /** Vinyl run info stored in .index file */
>>> VY_INDEX_RUN_INFO = 100,
>>> diff --git a/src/box/relay.cc b/src/box/relay.cc
>>> index e849fcf4f..14644716d 100644
>>> --- a/src/box/relay.cc
>>> +++ b/src/box/relay.cc
>>> @@ -569,11 +569,17 @@ relay_subscribe_f(va_list ap)
>>> cbus_pair("tx", relay->endpoint.name, &relay->tx_pipe,
>>> &relay->relay_pipe, NULL, NULL, cbus_process);
>>>
>>> -/* Setup garbage collection trigger. */
>>> +/*
>>> + * Setup garbage collection trigger.
>>> + * Not needed for anonymous replicas, since they
>>> + * aren't registered with gc at all.
>>> + */
>>
>> 14. If a master does not register an anon replica as a gc consumer,
>> it will remove xlogs even if the replica didn't get them yet. Not
>> sure, if we want that behaviour. AFAIU, purpose of anon replicas
>> is to break the limit on vlock size about 32 instances only.
>
> True, but if we do register replicas as gc consumers there is no way
> to exclude them, so such a replica, in case of failure, will stall gc on master
> forever. We need some mechanism, to remove anonymous replicas from gc
> consumers. Normal replicas can be removed by deleting their entries from
> _cluster, we cannot do this for anonymous replicas. And if we just remove
> replica from gc consumer on every disconnect, there is no point in registering
> it with gc at all, since the point of gc consumer, among others, is to wait for
> dead replicas to reconnect and collect xlogs.
How anon replicas are removed now? I mean when are they dropped automatically
from the master? Is it done on each disconnect?