From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6ED974696C4 for ; Tue, 28 Apr 2020 19:13:23 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id g4so22122829ljl.2 for ; Tue, 28 Apr 2020 09:13:23 -0700 (PDT) From: Cyrill Gorcunov Date: Tue, 28 Apr 2020 19:11:27 +0300 Message-Id: <20200428161137.20536-8-gorcunov@gmail.com> In-Reply-To: <20200428161137.20536-1-gorcunov@gmail.com> References: <20200428161137.20536-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 07/17] recovery: hot_standby_f -- don't throw exception List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml Prepare for transition to plain C. Signed-off-by: Cyrill Gorcunov --- src/box/recovery.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/box/recovery.cc b/src/box/recovery.cc index 1b78fc915..996966a77 100644 --- a/src/box/recovery.cc +++ b/src/box/recovery.cc @@ -494,18 +494,15 @@ hot_standby_f(va_list ap) struct recovery *r = va_arg(ap, struct recovery *); struct xstream *stream = va_arg(ap, struct xstream *); bool scan_dir = true; + int rc = 0; ev_tstamp wal_dir_rescan_delay = va_arg(ap, ev_tstamp); fiber_set_user(fiber(), &admin_credentials); struct wal_subscr ws; - auto guard = make_scoped_guard([&]{ - wal_subscr_destroy(&ws); - }); - wal_subscr_create(&ws, r->wal_dir.dirname); - while (! fiber_is_cancelled()) { + while (!fiber_is_cancelled()) { /* * Recover until there is no new stuff which appeared in @@ -519,8 +516,16 @@ hot_standby_f(va_list ap) do { start = vclock_sum(&r->vclock); - if (recover_remaining_wals(r, stream, NULL, scan_dir) != 0) - diag_raise(); + if (recover_remaining_wals(r, stream, NULL, scan_dir) != 0) { + /* + * Since we're the fiber function the wrapper + * fiber_cxx_invoke doesn't log the real reson + * of the failure. Thus make it so explicitly. + */ + diag_log(); + rc = -1; + goto out; + } end = vclock_sum(&r->vclock); /* @@ -548,7 +553,9 @@ hot_standby_f(va_list ap) scan_dir = timed_out || (ws.events & WAL_EVENT_ROTATE) != 0; ws.events = 0; } - return 0; +out: + wal_subscr_destroy(&ws); + return rc; } void -- 2.20.1