Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: mechanik20051988 <mechanik20051988@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org,
	mechanik20051988 <mechanik20.05.1988@gmail.com>
Subject: Re: [Tarantool-patches] [PATCH v3 5/8] iproto: implement streams in iproto
Date: Wed, 11 Aug 2021 14:30:22 +0300	[thread overview]
Message-ID: <20210811113022.6qm5wfo4sn57x264@esperanza> (raw)
In-Reply-To: <c2b4c17f9cbe383c3ceedfc931ece5d9a562d438.1628671235.git.mechanik20051988@tarantool.org>

On Wed, Aug 11, 2021 at 11:56:55AM +0300, mechanik20051988 wrote:
> diff --git a/src/box/iproto.cc b/src/box/iproto.cc
> index dcf60e1be..3b792130b 100644
> --- a/src/box/iproto.cc
> +++ b/src/box/iproto.cc
> @@ -1873,12 +2049,52 @@ tx_process_replication(struct cmsg *m)
>  	}
>  }
>  
> +static void
> +iproto_msg_finish_processing_in_stream(struct iproto_msg *msg)
> +{
> +	struct iproto_connection *con = msg->connection;
> +	struct iproto_stream *stream = msg->stream;
> +
> +	assert(stream != NULL);
> +	struct iproto_msg *tmp =
> +		stailq_shift_entry(&stream->pending_requests,
> +				   struct iproto_msg, in_stream);
> +	assert(tmp == msg);
> +	(void)tmp;
> +	errinj_stream_msg_count_add(-1);
> +
> +	if (stailq_empty(&stream->pending_requests)) {
> +		struct mh_i64ptr_node_t node = { stream->id, NULL };
> +		mh_i64ptr_remove(con->streams, &node, 0);
> +		iproto_stream_delete(stream);
> +	} else {
> +		/*
> +		 * If there are new messages for this stream
> +		 * then schedule their processing.
> +		 */
> +		struct iproto_msg *next =
> +			stailq_first_entry(&stream->pending_requests,
> +					   struct iproto_msg,
> +					   in_stream);
> +		assert(next != NULL);
> +		next->wpos = con->wpos;
> +		cpipe_push_input(&con->iproto_thread->tx_pipe, &next->base);
> +		cpipe_flush_input(&con->iproto_thread->tx_pipe);
> +	}
> +}
> +
>  static void
>  net_send_msg(struct cmsg *m)
>  {
>  	struct iproto_msg *msg = (struct iproto_msg *) m;
>  	struct iproto_connection *con = msg->connection;
> +	struct iproto_stream *stream = msg->stream;
> +
> +	if (stream == NULL)
> +		goto send_msg;

Please fold this check into iproto_msg_finish_processing_in_stream
and call the latter unconditionally, like you do in case of
iproto_msg_start_processing_in_stream.

After this LGTM.

>  
> +	iproto_msg_finish_processing_in_stream(msg);
> +send_msg:
>  	if (msg->len != 0) {
>  		/* Discard request (see iproto_enqueue_batch()). */
>  		msg->p_ibuf->rpos += msg->len;

  reply	other threads:[~2021-08-11 11:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  8:56 [Tarantool-patches] [PATCH v3 0/8] implement iproto streams mechanik20051988 via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 1/8] xrow: remove unused call_request::header mechanik20051988 via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 2/8] iproto: clear request::header for client requests mechanik20051988 via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 3/8] iproto: implement stream id in binary iproto protocol mechanik20051988 via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 4/8] salad: fix segfault in case when mhash table allocation failure mechanik20051988 via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 5/8] iproto: implement streams in iproto mechanik20051988 via Tarantool-patches
2021-08-11 11:30   ` Vladimir Davydov via Tarantool-patches [this message]
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 6/8] net.box: add stream support to net.box mechanik20051988 via Tarantool-patches
2021-08-11 11:52   ` Vladimir Davydov via Tarantool-patches
2021-08-11 12:09   ` Vladimir Davydov via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 7/8] iproto: implement interactive transactions over iproto streams mechanik20051988 via Tarantool-patches
2021-08-11 12:39   ` Vladimir Davydov via Tarantool-patches
2021-08-11  8:56 ` [Tarantool-patches] [PATCH v3 8/8] net.box: add interactive transaction support in net.box mechanik20051988 via Tarantool-patches
2021-08-11 12:47   ` Vladimir Davydov via Tarantool-patches

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=20210811113022.6qm5wfo4sn57x264@esperanza \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=mechanik20.05.1988@gmail.com \
    --cc=mechanik20051988@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --cc=vdavydov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3 5/8] iproto: implement streams in iproto' \
    /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