[Tarantool-patches] [PATCH v4 07/16] replication: send current Raft term in join response

Sergey Petrenko sergepetrenko at tarantool.org
Fri Jul 23 10:44:58 MSK 2021


22.07.2021 01:24, Vladislav Shpilevoy пишет:
> Thanks for the patch!
>
>> diff --git a/src/box/relay.cc b/src/box/relay.cc
>> index 4b102a777..70f1a045b 100644
>> --- a/src/box/relay.cc
>> +++ b/src/box/relay.cc
>> @@ -451,6 +453,10 @@ relay_initial_join(int fd, uint64_t sync, struct vclock *vclock,
>>   		row.sync = sync;
>>   		coio_write_xrow(&relay->io, &row);
>>   
>> +		xrow_encode_raft(&row, &fiber()->gc, &raft_req);
>> +		row.sync = sync;
>> +		coio_write_xrow(&relay->io, &row);
> You might need to send it before the limbo checkpoint. Otherwise
> the problem is exactly the same - the master could send the limbo
> state, the replica applied it, then the master dies before sending the
> raft state, then the replica has limbo's term > raft term.


Yep, thanks for noticing! Fixed.

===============================

diff --git a/src/box/relay.cc b/src/box/relay.cc
index b413b713c..805b5e7ff 100644
--- a/src/box/relay.cc
+++ b/src/box/relay.cc
@@ -447,15 +447,14 @@ relay_initial_join(int fd, uint64_t sync, struct 
vclock *vclock,
                 row.type = IPROTO_JOIN_META;
                 coio_write_xrow(&relay->io, &row);

+               xrow_encode_raft(&row, &fiber()->gc, &raft_req);
+               coio_write_xrow(&relay->io, &row);
+
                 char body[XROW_SYNCHRO_BODY_LEN_MAX];
                 xrow_encode_synchro(&row, body, &req);
                 row.replica_id = req.replica_id;
                 coio_write_xrow(&relay->io, &row);

-               xrow_encode_raft(&row, &fiber()->gc, &raft_req);
-               row.sync = sync;
-               coio_write_xrow(&relay->io, &row);
-
                 /* Mark the end of the metadata stream. */
                 row.type = IPROTO_JOIN_SNAPSHOT;
                 coio_write_xrow(&relay->io, &row);

===============================

> I wish we could test it somehow simple.


More information about the Tarantool-patches mailing list