mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Fixed race condition at startup [#CLICKHOUSE-2]
This commit is contained in:
parent
fca64bb9da
commit
1aad435d52
@ -24,7 +24,11 @@ ConfigReloader::ConfigReloader(
|
||||
{
|
||||
if (!already_loaded)
|
||||
reloadIfNewer(/* force = */ true, /* throw_on_error = */ true, /* fallback_to_preprocessed = */ true);
|
||||
}
|
||||
|
||||
|
||||
void ConfigReloader::start()
|
||||
{
|
||||
thread = std::thread(&ConfigReloader::run, this);
|
||||
}
|
||||
|
||||
@ -35,7 +39,9 @@ ConfigReloader::~ConfigReloader()
|
||||
{
|
||||
quit = true;
|
||||
zk_node_cache.getChangedEvent().set();
|
||||
thread.join();
|
||||
|
||||
if (thread.joinable())
|
||||
thread.join();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -39,6 +39,9 @@ public:
|
||||
|
||||
~ConfigReloader();
|
||||
|
||||
/// Call this method to run the backround thread.
|
||||
void start();
|
||||
|
||||
private:
|
||||
void run();
|
||||
|
||||
|
@ -473,6 +473,9 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
for (auto & server : servers)
|
||||
server->start();
|
||||
|
||||
main_config_reloader->start();
|
||||
users_config_reloader->start();
|
||||
|
||||
{
|
||||
std::stringstream message;
|
||||
message << "Available RAM = " << formatReadableSizeWithBinarySuffix(getMemoryAmount()) << ";"
|
||||
|
Loading…
Reference in New Issue
Block a user