api,main: Unset storage_proxy API on stop
So that the routes referencing and using ctx.sp don't step on a proxy that's going to be removed (not now, but some time later) fron under them on shutdown. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -194,6 +194,10 @@ future<> set_server_storage_proxy(http_context& ctx, sharded<service::storage_se
|
||||
});
|
||||
}
|
||||
|
||||
future<> unset_server_storage_proxy(http_context& ctx) {
|
||||
return ctx.http_server.set_routes([&ctx] (routes& r) { unset_storage_proxy(ctx, r); });
|
||||
}
|
||||
|
||||
future<> set_server_stream_manager(http_context& ctx, sharded<streaming::stream_manager>& sm) {
|
||||
return register_api(ctx, "stream_manager",
|
||||
"The stream manager API", [&sm] (http_context& ctx, routes& r) {
|
||||
|
||||
@@ -107,6 +107,7 @@ future<> unset_server_load_sstable(http_context& ctx);
|
||||
future<> set_server_messaging_service(http_context& ctx, sharded<netw::messaging_service>& ms);
|
||||
future<> unset_server_messaging_service(http_context& ctx);
|
||||
future<> set_server_storage_proxy(http_context& ctx, sharded<service::storage_service>& ss);
|
||||
future<> unset_server_storage_proxy(http_context& ctx);
|
||||
future<> set_server_stream_manager(http_context& ctx, sharded<streaming::stream_manager>& sm);
|
||||
future<> unset_server_stream_manager(http_context& ctx);
|
||||
future<> set_hinted_handoff(http_context& ctx, sharded<gms::gossiper>& g);
|
||||
|
||||
@@ -518,4 +518,73 @@ void set_storage_proxy(http_context& ctx, routes& r, sharded<service::storage_se
|
||||
});
|
||||
}
|
||||
|
||||
void unset_storage_proxy(http_context& ctx, routes& r) {
|
||||
sp::get_total_hints.unset(r);
|
||||
sp::get_hinted_handoff_enabled.unset(r);
|
||||
sp::set_hinted_handoff_enabled.unset(r);
|
||||
sp::get_hinted_handoff_enabled_by_dc.unset(r);
|
||||
sp::set_hinted_handoff_enabled_by_dc_list.unset(r);
|
||||
sp::get_max_hint_window.unset(r);
|
||||
sp::set_max_hint_window.unset(r);
|
||||
sp::get_max_hints_in_progress.unset(r);
|
||||
sp::set_max_hints_in_progress.unset(r);
|
||||
sp::get_hints_in_progress.unset(r);
|
||||
sp::get_rpc_timeout.unset(r);
|
||||
sp::set_rpc_timeout.unset(r);
|
||||
sp::get_read_rpc_timeout.unset(r);
|
||||
sp::set_read_rpc_timeout.unset(r);
|
||||
sp::get_write_rpc_timeout.unset(r);
|
||||
sp::set_write_rpc_timeout.unset(r);
|
||||
sp::get_counter_write_rpc_timeout.unset(r);
|
||||
sp::set_counter_write_rpc_timeout.unset(r);
|
||||
sp::get_cas_contention_timeout.unset(r);
|
||||
sp::set_cas_contention_timeout.unset(r);
|
||||
sp::get_range_rpc_timeout.unset(r);
|
||||
sp::set_range_rpc_timeout.unset(r);
|
||||
sp::get_truncate_rpc_timeout.unset(r);
|
||||
sp::set_truncate_rpc_timeout.unset(r);
|
||||
sp::reload_trigger_classes.unset(r);
|
||||
sp::get_read_repair_attempted.unset(r);
|
||||
sp::get_read_repair_repaired_blocking.unset(r);
|
||||
sp::get_read_repair_repaired_background.unset(r);
|
||||
sp::get_schema_versions.unset(r);
|
||||
sp::get_cas_read_timeouts.unset(r);
|
||||
sp::get_cas_read_unavailables.unset(r);
|
||||
sp::get_cas_write_timeouts.unset(r);
|
||||
sp::get_cas_write_unavailables.unset(r);
|
||||
sp::get_cas_write_metrics_unfinished_commit.unset(r);
|
||||
sp::get_cas_write_metrics_contention.unset(r);
|
||||
sp::get_cas_write_metrics_condition_not_met.unset(r);
|
||||
sp::get_cas_write_metrics_failed_read_round_optimization.unset(r);
|
||||
sp::get_cas_read_metrics_unfinished_commit.unset(r);
|
||||
sp::get_cas_read_metrics_contention.unset(r);
|
||||
sp::get_read_metrics_timeouts.unset(r);
|
||||
sp::get_read_metrics_unavailables.unset(r);
|
||||
sp::get_range_metrics_timeouts.unset(r);
|
||||
sp::get_range_metrics_unavailables.unset(r);
|
||||
sp::get_write_metrics_timeouts.unset(r);
|
||||
sp::get_write_metrics_unavailables.unset(r);
|
||||
sp::get_read_metrics_timeouts_rates.unset(r);
|
||||
sp::get_read_metrics_unavailables_rates.unset(r);
|
||||
sp::get_range_metrics_timeouts_rates.unset(r);
|
||||
sp::get_range_metrics_unavailables_rates.unset(r);
|
||||
sp::get_write_metrics_timeouts_rates.unset(r);
|
||||
sp::get_write_metrics_unavailables_rates.unset(r);
|
||||
sp::get_range_metrics_latency_histogram_depricated.unset(r);
|
||||
sp::get_write_metrics_latency_histogram_depricated.unset(r);
|
||||
sp::get_read_metrics_latency_histogram_depricated.unset(r);
|
||||
sp::get_range_metrics_latency_histogram.unset(r);
|
||||
sp::get_write_metrics_latency_histogram.unset(r);
|
||||
sp::get_cas_write_metrics_latency_histogram.unset(r);
|
||||
sp::get_cas_read_metrics_latency_histogram.unset(r);
|
||||
sp::get_view_write_metrics_latency_histogram.unset(r);
|
||||
sp::get_read_metrics_latency_histogram.unset(r);
|
||||
sp::get_read_estimated_histogram.unset(r);
|
||||
sp::get_read_latency.unset(r);
|
||||
sp::get_write_estimated_histogram.unset(r);
|
||||
sp::get_write_latency.unset(r);
|
||||
sp::get_range_estimated_histogram.unset(r);
|
||||
sp::get_range_latency.unset(r);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,5 +16,6 @@ namespace service { class storage_service; }
|
||||
namespace api {
|
||||
|
||||
void set_storage_proxy(http_context& ctx, httpd::routes& r, sharded<service::storage_service>& ss);
|
||||
void unset_storage_proxy(http_context& ctx, httpd::routes& r);
|
||||
|
||||
}
|
||||
|
||||
3
main.cc
3
main.cc
@@ -1318,6 +1318,9 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
api::unset_server_snitch(ctx).get();
|
||||
});
|
||||
api::set_server_storage_proxy(ctx, ss).get();
|
||||
auto stop_sp_api = defer_verbose_shutdown("storage proxy API", [&ctx] {
|
||||
api::unset_server_storage_proxy(ctx).get();
|
||||
});
|
||||
api::set_server_load_sstable(ctx, sys_ks).get();
|
||||
auto stop_cf_api = defer_verbose_shutdown("column family API", [&ctx] {
|
||||
api::unset_server_load_sstable(ctx).get();
|
||||
|
||||
Reference in New Issue
Block a user