From 8f8ed625abd9e970e48c8d591e8c537318de6ba4 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 24 Aug 2020 13:38:21 +0300 Subject: [PATCH] view_builder: Always resolve started future to success If the view builder background start fails, the _started future resolves to exceptional state. In turn, stopping the view builder keeps this state through .finally() and aborts the shutdown very early, while it may and should proceed. Signed-off-by: Pavel Emelyanov --- db/view/view.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/view/view.cc b/db/view/view.cc index 7e0b0e27cc..037c711fa6 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -1278,6 +1278,9 @@ future<> view_builder::start(service::migration_manager& mm) { (void)_build_step.trigger(); return make_ready_future<>(); }); + }).handle_exception([] (std::exception_ptr eptr) { + vlogger.error("start failed: {}", eptr); + return make_ready_future<>(); }); return make_ready_future<>(); } @@ -1285,7 +1288,7 @@ future<> view_builder::start(service::migration_manager& mm) { future<> view_builder::stop() { vlogger.info("Stopping view builder"); _as.request_abort(); - return _started.finally([this] { + return _started.then([this] { return _mnotifier.unregister_listener(this).then([this] { return _sem.wait(); }).then([this] {