From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CD1474696C1 for ; Sat, 23 Nov 2019 16:39:16 +0300 (MSK) References: <513167ba5e8823d58cbe101e10bfa423fff083a1.1574178520.git.georgy@tarantool.org> From: Vladislav Shpilevoy Message-ID: <1a0049f1-7f53-714a-307a-24ed07415fd2@tarantool.org> Date: Sat, 23 Nov 2019 14:45:56 +0100 MIME-Version: 1.0 In-Reply-To: <513167ba5e8823d58cbe101e10bfa423fff083a1.1574178520.git.georgy@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 3/6] xstream: get rid of an exception List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Georgy Kirichenko , tarantool-patches@dev.tarantool.org 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.