diff --git a/config-shell.ini.203047 b/config-shell.ini.203047 new file mode 100644 index 0000000000..35ee9c8f92 --- /dev/null +++ b/config-shell.ini.203047 @@ -0,0 +1,69 @@ +[apps..default] +run = true +count = 1 +;network.client.RPC_CHANNEL_TCP = dsn::tools::sim_network_provider, 65536 +;network.client.RPC_CHANNEL_UDP = dsn::tools::sim_network_provider, 65536 +;network.server.0.RPC_CHANNEL_TCP = dsn::tools::sim_network_provider, 65536 + +[apps.mimic] +type = dsn.app.mimic +arguments = +pools = THREAD_POOL_DEFAULT,THREAD_POOL_META_SERVER +run = true +count = 1 + +[core] +;tool = simulator +tool = nativerun +;toollets = tracer +;toollets = tracer, profiler, fault_injector +pause_on_start = false + +;aio_factory_name = dsn::tools::native_aio_provider + +logging_start_level = LOG_LEVEL_DEBUG +logging_factory_name = dsn::tools::simple_logger +;logging_factory_name = dsn::tools::screen_logger +logging_flush_on_exit = false + +enable_default_app_mimic = true + +data_dir = ./pegasus_shell.data + +[tools.simple_logger] +short_header = false +fast_flush = true +max_number_of_log_files_on_disk = 10 +stderr_start_level = LOG_LEVEL_FATAL + +[tools.simulator] +random_seed = 0 + +[network] +; how many network threads for network library(used by asio) +io_service_worker_count = 4 + +; specification for each thread pool +[threadpool..default] +worker_count = 4 +partitioned = false +worker_priority = THREAD_xPRIORITY_NORMAL + +[threadpool.THREAD_POOL_DEFAULT] +name = default +worker_count = 8 + +[threadpool.THREAD_POOL_META_SERVER] +name = meta_server + +[task..default] +is_trace = false +is_profile = false +allow_inline = false +rpc_call_header_format = NET_HDR_DSN +rpc_call_channel = RPC_CHANNEL_TCP +rpc_timeout_milliseconds = 10000 + +[pegasus.clusters] +onebox = 127.0.0.1:34601,127.0.0.1:34602,127.0.0.1:34603 + diff --git a/src/server/hotkey_collector.cpp b/src/server/hotkey_collector.cpp index fdc7919e41..8e39c220f8 100644 --- a/src/server/hotkey_collector.cpp +++ b/src/server/hotkey_collector.cpp @@ -77,8 +77,9 @@ void hotkey_collector::analyse_data() { switch (_state.load()) { case hotkey_collector_state::COARSE_DETECTING: - terminate_if_timeout(); - _internal_collector->analyse_data(); + if (terminate_if_timeout()) { + _internal_collector->analyse_data(); + } return; default: return; @@ -100,9 +101,9 @@ void hotkey_collector::on_start_detect(dsn::replication::detect_hotkey_response return; case hotkey_collector_state::FINISHED: resp.err = dsn::ERR_INVALID_STATE; - hint = fmt::format("{} hotkey result has been found, you can send a stop rpc to " - "restart hotkey detection", - dsn::enum_to_string(_hotkey_type)); + hint = fmt::format( + "{} hotkey result has been found, you can send a stop rpc to restart hotkey detection", + dsn::enum_to_string(_hotkey_type)); dwarn_replica(hint); return; case hotkey_collector_state::STOPPED: @@ -138,17 +139,15 @@ void hotkey_collector::terminate() _collector_start_time = 0; } -void hotkey_collector::terminate_if_timeout() +bool hotkey_collector::terminate_if_timeout() { - if (_collector_start_time == 0) { - return; - } if (dsn_now_s() >= _collector_start_time + FLAGS_max_seconds_to_detect_hotkey) { ddebug_replica("hotkey collector work time is exhausted but no hotkey has been found"); terminate(); - return; + return false; } -}; + return true; +} } // namespace server } // namespace pegasus diff --git a/src/server/hotkey_collector.h b/src/server/hotkey_collector.h index c07cc15096..ca2f0bb8c8 100644 --- a/src/server/hotkey_collector.h +++ b/src/server/hotkey_collector.h @@ -80,7 +80,7 @@ class hotkey_collector : public dsn::replication::replica_base void on_start_detect(dsn::replication::detect_hotkey_response &resp); void on_stop_detect(dsn::replication::detect_hotkey_response &resp); void terminate(); - void terminate_if_timeout(); + bool terminate_if_timeout(); std::atomic _state; const dsn::replication::hotkey_type::type _hotkey_type;