[Tarantool-patches] [PATCH 3/6] xstream: get rid of an exception

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Nov 23 16:45:56 MSK 2019


Thanks for the patch!

See 3 comments below.

On 19/11/2019 17:04, Georgy Kirichenko wrote:
> Refactoring: make xstream C-compliant
> 
> Part of #380
> ---
>  src/box/box.cc     |  5 +++--
>  src/box/relay.cc   | 23 +++++++++++++----------
>  src/box/xstream.cc |  7 +------
>  src/box/xstream.h  |  2 +-
>  4 files changed, 18 insertions(+), 19 deletions(-)
> 
> diff --git a/src/box/box.cc b/src/box/box.cc
> index 6323e5e6e..f41ef9ce8 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -321,7 +321,7 @@ recovery_journal_create(struct recovery_journal *journal, struct vclock *v)
>  	journal->vclock = v;
>  }
>  
> -static void
> +static int
>  apply_wal_row(struct xstream *stream, struct xrow_header *row)
>  {
>  	struct request request;
> @@ -330,7 +330,7 @@ apply_wal_row(struct xstream *stream, struct xrow_header *row)
>  		struct space *space = space_cache_find_xc(request.space_id);
>  		if (box_process_rw(&request, space, NULL) != 0) {
>  			say_error("error applying row: %s", request_str(&request));
> -			diag_raise();
> +			return -1;

1. apply_wal_row() still throws exceptions. It uses xrow_decode_dml_xc() and
space_cache_find_xc().

>  		}
>  	}
>  	struct wal_stream *xstream =
> diff --git a/src/box/relay.cc b/src/box/relay.cc
> index 202620694..fe5e0cfc9 100644
> --- a/src/box/relay.cc
> +++ b/src/box/relay.cc
> @@ -165,11 +165,11 @@ relay_last_row_time(const struct relay *relay)
>  	return relay->last_row_time;
>  }
>  
> -static void
> +static int
>  relay_send(struct relay *relay, struct xrow_header *packet);

2. relay_send_heartbeat() still assumes, that relay_send() throws.

> -static void
> +static int
>  relay_send_initial_join_row(struct xstream *stream, struct xrow_header *row);
> -static void
> +static int
>  relay_send_row(struct xstream *stream, struct xrow_header *row);
>  
>  struct relay *
> diff --git a/src/box/xstream.cc b/src/box/xstream.cc
> index c77e4360e..80f3030d0 100644
> --- a/src/box/xstream.cc
> +++ b/src/box/xstream.cc
> @@ -35,10 +35,5 @@
>  int
>  xstream_write(struct xstream *stream, struct xrow_header *row)
>  {
> -	try {
> -		stream->write(stream, row);
> -	} catch (Exception *e) {
> -		return -1;
> -	}
> -	return 0;
> +	return stream->write(stream, row);
>  }

3. Now you can drop xstream.cc, and make xstream_write() static
inline in xstream.h header.


More information about the Tarantool-patches mailing list