storage_service: Fix is_starting API

Query _operation_mode on CPU 0.

$ curl -X GET --header "Accept: application/json"
"http://127.0.0.1:10000/storage_service/is_starting"
This commit is contained in:
Asias He
2015-09-08 11:07:13 +08:00
parent 5e3d8a56b2
commit 312daed342
3 changed files with 10 additions and 5 deletions

View File

@@ -325,8 +325,10 @@ void set_storage_service(http_context& ctx, routes& r) {
});
});
ss::is_starting.set(r, [](const_req req) {
return service::get_local_storage_service().is_starting();
ss::is_starting.set(r, [](std::unique_ptr<request> req) {
return service::get_local_storage_service().is_starting().then([] (auto starting) {
return make_ready_future<json::json_return_type>(starting);
});
});
ss::get_drain_progress.set(r, [](std::unique_ptr<request> req) {

View File

@@ -1180,8 +1180,11 @@ future<sstring> storage_service::get_operation_mode() {
});
}
bool storage_service::is_starting() {
return _operation_mode == storage_service::mode::STARTING;
future<bool> storage_service::is_starting() {
return smp::submit_to(0, [] {
auto mode = get_local_storage_service()._operation_mode;
return mode == storage_service::mode::STARTING;
});
}
future<bool> storage_service::is_gossip_running() {

View File

@@ -2448,7 +2448,7 @@ public:
#endif
future<sstring> get_operation_mode();
bool is_starting();
future<bool> is_starting();
#if 0
public String getDrainProgress()
{