mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-28 20:50:49 +00:00
restart runMainThread in cluster discovery
This commit is contained in:
parent
4f8a9cc539
commit
72e63b4f12
@ -322,19 +322,29 @@ void ClusterDiscovery::start()
|
||||
}
|
||||
|
||||
main_thread = ThreadFromGlobalPool([this]
|
||||
{
|
||||
bool finish = false;
|
||||
while (!finish)
|
||||
{
|
||||
try
|
||||
{
|
||||
runMainThread();
|
||||
finish = runMainThread();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
/*
|
||||
* it can be zk error (will take new session) or other retriable error,
|
||||
* should not stop discovery forever
|
||||
*/
|
||||
tryLogCurrentException(log, "Caught exception in cluster discovery runMainThread");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void ClusterDiscovery::runMainThread()
|
||||
|
||||
/// Returns `true` on gracefull shutdown (no restart required)
|
||||
bool ClusterDiscovery::runMainThread()
|
||||
{
|
||||
setThreadName("ClusterDiscover");
|
||||
LOG_DEBUG(log, "Worker thread started");
|
||||
@ -362,6 +372,7 @@ void ClusterDiscovery::runMainThread()
|
||||
}
|
||||
}
|
||||
LOG_DEBUG(log, "Worker thread stopped");
|
||||
return stop_flag;
|
||||
}
|
||||
|
||||
void ClusterDiscovery::shutdown()
|
||||
|
@ -94,7 +94,7 @@ private:
|
||||
bool updateCluster(const String & cluster_name);
|
||||
bool updateCluster(ClusterInfo & cluster_info);
|
||||
|
||||
void runMainThread();
|
||||
bool runMainThread();
|
||||
void shutdown();
|
||||
|
||||
/// cluster name -> cluster info (zk root, set of nodes)
|
||||
|
Loading…
Reference in New Issue
Block a user