[Tarantool-patches] [PATCH 08/17] recovery: recovery_follow_local -- don't throw exception

Cyrill Gorcunov gorcunov at gmail.com
Tue Apr 28 19:11:28 MSK 2020


Prepare for transition to plain C.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 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



More information about the Tarantool-patches mailing list