From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 0A1554696C9 for ; Tue, 28 Apr 2020 19:13:35 +0300 (MSK) Received: by mail-lf1-f50.google.com with SMTP id r17so17370485lff.2 for ; Tue, 28 Apr 2020 09:13:34 -0700 (PDT) From: Cyrill Gorcunov Date: Tue, 28 Apr 2020 19:11:28 +0300 Message-Id: <20200428161137.20536-9-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 08/17] recovery: recovery_follow_local -- 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/box.cc | 5 +++-- src/box/recovery.cc | 7 +++++-- src/box/recovery.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index ff095d767..7551ca753 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -2292,8 +2292,9 @@ local_recovery(const struct tt_uuid *instance_uuid, if (wal_dir_lock < 0) { title("hot_standby"); say_info("Entering hot standby mode"); - recovery_follow_local(recovery, &wal_stream.base, "hot_standby", - cfg_getd("wal_dir_rescan_delay")); + if (recovery_follow_local(recovery, &wal_stream.base, "hot_standby", + cfg_getd("wal_dir_rescan_delay")) != 0) + diag_raise(); while (true) { if (path_lock(cfg_gets("wal_dir"), &wal_dir_lock)) { recovery_stop_local(recovery); diff --git a/src/box/recovery.cc b/src/box/recovery.cc index 996966a77..24036b7c1 100644 --- a/src/box/recovery.cc +++ b/src/box/recovery.cc @@ -558,7 +558,7 @@ hot_standby_f(va_list ap) return rc; } -void +int recovery_follow_local(struct recovery *r, struct xstream *stream, const char *name, ev_tstamp wal_dir_rescan_delay) { @@ -568,9 +568,12 @@ recovery_follow_local(struct recovery *r, struct xstream *stream, * xlog. */ assert(r->watcher == NULL); - r->watcher = fiber_new_xc(name, hot_standby_f); + r->watcher = fiber_new(name, hot_standby_f); + if (!r->watcher) + return -1; fiber_set_joinable(r->watcher, true); fiber_start(r->watcher, r, stream, wal_dir_rescan_delay); + return 0; } void diff --git a/src/box/recovery.h b/src/box/recovery.h index a2fb99070..7aa496b14 100644 --- a/src/box/recovery.h +++ b/src/box/recovery.h @@ -78,7 +78,7 @@ void recovery_scan(struct recovery *r, struct vclock *end_vclock, struct vclock *gc_vclock); -void +int recovery_follow_local(struct recovery *r, struct xstream *stream, const char *name, ev_tstamp wal_dir_rescan_delay); -- 2.20.1