mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 01:00:48 +00:00
Avoid std::terminate in case of exception from SystemLogs::SystemLogs
Since, at least, this will hide the real exception
This commit is contained in:
parent
699ef4ff52
commit
c42943850f
@ -98,11 +98,21 @@ SystemLogs::SystemLogs(Context & global_context, const Poco::Util::AbstractConfi
|
||||
logs.emplace_back(metric_log.get());
|
||||
|
||||
bool lazy_load = config.getBool("system_tables_lazy_load", true);
|
||||
for (auto & log : logs)
|
||||
|
||||
try
|
||||
{
|
||||
if (!lazy_load)
|
||||
log->prepareTable();
|
||||
log->startup();
|
||||
for (auto & log : logs)
|
||||
{
|
||||
if (!lazy_load)
|
||||
log->prepareTable();
|
||||
log->startup();
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
/// join threads
|
||||
shutdown();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,7 @@ SystemLog<LogElement>::SystemLog(Context & context_,
|
||||
template <typename LogElement>
|
||||
void SystemLog<LogElement>::startup()
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
saving_thread = ThreadFromGlobalPool([this] { savingThreadFunction(); });
|
||||
}
|
||||
|
||||
@ -288,6 +289,11 @@ void SystemLog<LogElement>::stopFlushThread()
|
||||
{
|
||||
std::unique_lock lock(mutex);
|
||||
|
||||
if (!saving_thread.joinable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_shutdown)
|
||||
{
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user