storage_service: Serialize is_joined with read api lock
This commit is contained in:
@@ -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<request> req) {
|
||||
return service::get_local_storage_service().is_joined().then([] (bool is_joined) {
|
||||
return make_ready_future<json::json_return_type>(is_joined);
|
||||
});
|
||||
});
|
||||
|
||||
ss::set_stream_throughput_mb_per_sec.set(r, [](std::unique_ptr<request> req) {
|
||||
|
||||
@@ -379,6 +379,13 @@ future<> storage_service::join_ring() {
|
||||
});
|
||||
}
|
||||
|
||||
future<bool> 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<token> tokens) {
|
||||
_is_bootstrap_mode = true;
|
||||
|
||||
@@ -361,9 +361,7 @@ private:
|
||||
void join_token_ring(int delay);
|
||||
public:
|
||||
future<> join_ring();
|
||||
bool is_joined() {
|
||||
return _joined;
|
||||
}
|
||||
future<bool> is_joined();
|
||||
|
||||
future<> rebuild(sstring source_dc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user