Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Petrenko <sergepetrenko@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	gorcunov@gmail.com, sergos@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [RAFT 02/10] raft: relay status updates to followers
Date: Fri, 28 Aug 2020 13:10:59 +0300	[thread overview]
Message-ID: <93f8a2ab-165e-09c3-f23c-effaacf6e0bf@tarantool.org> (raw)
In-Reply-To: <82f89c29-2cce-4a5d-9698-0a240f4d263c@tarantool.org>


27.08.2020 23:36, Vladislav Shpilevoy пишет:
> Hi! Thanks for the patch!
Hi! Thanks for the review!
>> diff --git a/src/box/relay.cc b/src/box/relay.cc
>> index a7843a8c2..be252cad1 100644
>> --- a/src/box/relay.cc
>> +++ b/src/box/relay.cc
>> @@ -773,13 +774,40 @@ relay_send_initial_join_row(struct xstream *stream, struct xrow_header *row)
>>   		relay_send(relay, row);
>>   }
>>   
>> +static void
>> +relay_send_raft(struct relay *relay, struct raft_request *req)
>> +{
>> +	struct xrow_header packet;
>> +	xrow_encode_raft(&packet, &fiber()->gc, req);
>> +	relay_send(relay, &packet);
>> +}
>> +
>> +static void
>> +relay_send_raft_msg(struct cmsg *msg)
>> +{
>> +	struct raft_broadcast_msg *raft_msg = (struct raft_broadcast_msg *)msg;
>> +	struct relay *relay = container_of(msg->route[0].pipe, struct relay,
>> +					   tx_pipe);
>> +	relay_send_raft(relay, &raft_msg->req);
>> +}
>> +
>> +void
>> +relay_push_raft_msg(struct relay *relay, struct cmsg *msg,
>> +		    struct cmsg_hop *route)
>> +{
>> +	route[0].f = relay_send_raft_msg;
>> +	route[0].pipe = &relay->tx_pipe;
>> +	route[1].f = raft_free_msg;
>> +	route[1].pipe = NULL;
>> +	cmsg_init(msg, route);
>> +	cpipe_push(&relay->relay_pipe, msg);
>> +}
>> +
>>   /** Send a single row to the client. */
>>   static void
>>   relay_send_row(struct xstream *stream, struct xrow_header *packet)
>>   {
>>   	struct relay *relay = container_of(stream, struct relay, stream);
>> -	assert(iproto_type_is_dml(packet->type) ||
>> -	       iproto_type_is_synchro_request(packet->type));
>>   	if (packet->group_id == GROUP_LOCAL) {
>>   		/*
>>   		 * We do not relay replica-local rows to other
>> @@ -796,6 +824,8 @@ relay_send_row(struct xstream *stream, struct xrow_header *packet)
>>   		packet->group_id = GROUP_DEFAULT;
>>   		packet->bodycnt = 0;
>>   	}
>> +	assert(iproto_type_is_dml(packet->type) ||
>> +	       iproto_type_is_synchro_request(packet->type));
> Why did you move this check, if Raft uses relay_send() anyway? Not
> relay_send_row().

When relay sends a WAL to the replica, local raft rows end up in 
relay_send_row().
The rows are not sent, since they're local, but they fail this 
assertion, so I
moved it below the locality check.

>
>>   	/* Check if the rows from the instance are filtered. */
>>   	if ((1 << packet->replica_id & relay->id_filter) != 0)
>>   		return;

  reply	other threads:[~2020-08-28 10:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26  7:52 [Tarantool-patches] [RAFT 00/10] raft implementation Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 01/10] raft: introduce persistent raft state Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 02/10] raft: relay status updates to followers Serge Petrenko
2020-08-27 20:36   ` Vladislav Shpilevoy
2020-08-28 10:10     ` Sergey Petrenko [this message]
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 03/10] [tosquash] raft: return raft_request to xrow Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 04/10] [tosquash] raft: introduce IPROTO_RAFT_VCLOCK Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 05/10] [tosquash] xrow: refactor raft request codec Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 06/10] [tosquash] raft: don't fill raft_request manually Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 07/10] [tosquash] raft: rename curr_leader to leader Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 08/10] [tosquash] raft: rename raft_process to raft_process_recovery Serge Petrenko
2020-08-26  7:52 ` [Tarantool-patches] [RAFT 09/10] [tosquash] applier: handler error at raft row appliance Serge Petrenko
2020-08-26  7:53 ` [Tarantool-patches] [RAFT 10/10] [tosquash] relay: move raft broadcast details into relay Serge Petrenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93f8a2ab-165e-09c3-f23c-effaacf6e0bf@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=sergos@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [RAFT 02/10] raft: relay status updates to followers' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox