diff --git a/api/storage_service.cc b/api/storage_service.cc index ed2328d781..76d304c918 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -495,8 +495,10 @@ void set_storage_service(http_context& ctx, routes& r) { }); }); - ss::is_joined.set(r, [](const_req req) { - return service::get_local_storage_service().is_joined(); + ss::is_joined.set(r, [] (std::unique_ptr req) { + return service::get_local_storage_service().is_joined().then([] (bool is_joined) { + return make_ready_future(is_joined); + }); }); ss::set_stream_throughput_mb_per_sec.set(r, [](std::unique_ptr req) { diff --git a/service/storage_service.cc b/service/storage_service.cc index e858a71c2c..556c50f826 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -379,6 +379,13 @@ future<> storage_service::join_ring() { }); } +future storage_service::is_joined() { + return run_with_read_api_lock([] (storage_service& ss) { + return ss._joined; + }); +} + + // Runs inside seastar::async context void storage_service::bootstrap(std::unordered_set tokens) { _is_bootstrap_mode = true; diff --git a/service/storage_service.hh b/service/storage_service.hh index b758cfaa18..8b71f3ccd2 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -361,9 +361,7 @@ private: void join_token_ring(int delay); public: future<> join_ring(); - bool is_joined() { - return _joined; - } + future is_joined(); future<> rebuild(sstring source_dc);