From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp10.mail.ru (smtp10.mail.ru [94.100.181.92]) (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 9E9D3469710 for ; Sun, 3 May 2020 21:43:09 +0300 (MSK) References: <20200428161137.20536-1-gorcunov@gmail.com> <20200428161137.20536-4-gorcunov@gmail.com> From: Vladislav Shpilevoy Message-ID: Date: Sun, 3 May 2020 20:43:08 +0200 MIME-Version: 1.0 In-Reply-To: <20200428161137.20536-4-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 03/17] recovery: recovery_close_log -- don't throw exception List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Thanks for the patch! > diff --git a/src/box/recovery.cc b/src/box/recovery.cc > index 76b771a91..16e38cee2 100644 > --- a/src/box/recovery.cc > +++ b/src/box/recovery.cc > @@ -144,19 +144,22 @@ recovery_scan(struct recovery *r, struct vclock *end_vclock, > xlog_cursor_close(&cursor, false); > } > > -static inline void > +static int > recovery_close_log(struct recovery *r) > { > - if (!xlog_cursor_is_open(&r->cursor)) > - return; > - if (xlog_cursor_is_eof(&r->cursor)) { > - say_info("done `%s'", r->cursor.name); > - } else { > - say_warn("file `%s` wasn't correctly closed", > - r->cursor.name); > + if (xlog_cursor_is_open(&r->cursor)) { > + if (xlog_cursor_is_eof(&r->cursor)) { > + say_info("done `%s'", r->cursor.name); > + } else { > + say_warn("file `%s` wasn't correctly closed", > + r->cursor.name); > + } > + xlog_cursor_close(&r->cursor, false); > + > + if (trigger_run(&r->on_close_log, NULL) != 0) > + return -1; > } > - xlog_cursor_close(&r->cursor, false); > - trigger_run_xc(&r->on_close_log, NULL); > + return 0; > } Seems like you could avoid almost all these changes by simply this: ==================== -static inline void +static int recovery_close_log(struct recovery *r) { if (!xlog_cursor_is_open(&r->cursor)) - return; + return 0; if (xlog_cursor_is_eof(&r->cursor)) { say_info("done `%s'", r->cursor.name); } else { @@ -156,7 +156,7 @@ recovery_close_log(struct recovery *r) r->cursor.name); } xlog_cursor_close(&r->cursor, false); - trigger_run_xc(&r->on_close_log, NULL); + return trigger_run(&r->on_close_log, NULL); } ==================== Why so complex?