Merge pull request #57553 from evillique/fix-local-crash

Fix crash in clickhouse-local
This commit is contained in:
Nikolay Degterinsky 2023-12-08 22:57:52 +01:00 committed by GitHub
commit c5e52d260f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 7 deletions

View File

@ -4811,7 +4811,7 @@ void Context::initializeBackgroundExecutorsIfNeeded()
shared->are_background_executors_initialized = true; shared->are_background_executors_initialized = true;
} }
bool Context::areBackgroundExecutorsInitialized() bool Context::areBackgroundExecutorsInitialized() const
{ {
SharedLockGuard lock(shared->background_executors_mutex); SharedLockGuard lock(shared->background_executors_mutex);
return shared->are_background_executors_initialized; return shared->are_background_executors_initialized;

View File

@ -1202,7 +1202,7 @@ public:
/// Background executors related methods /// Background executors related methods
void initializeBackgroundExecutorsIfNeeded(); void initializeBackgroundExecutorsIfNeeded();
bool areBackgroundExecutorsInitialized(); bool areBackgroundExecutorsInitialized() const;
MergeMutateBackgroundExecutorPtr getMergeMutateExecutor() const; MergeMutateBackgroundExecutorPtr getMergeMutateExecutor() const;
OrdinaryBackgroundExecutorPtr getMovesExecutor() const; OrdinaryBackgroundExecutorPtr getMovesExecutor() const;

View File

@ -46,17 +46,20 @@ void StorageSystemServerSettings::fillData(MutableColumns & res_columns, Context
{"max_concurrent_insert_queries", std::to_string(context->getProcessList().getMaxInsertQueriesAmount())}, {"max_concurrent_insert_queries", std::to_string(context->getProcessList().getMaxInsertQueriesAmount())},
{"max_concurrent_select_queries", std::to_string(context->getProcessList().getMaxSelectQueriesAmount())}, {"max_concurrent_select_queries", std::to_string(context->getProcessList().getMaxSelectQueriesAmount())},
{"background_pool_size", std::to_string(context->getMergeMutateExecutor()->getMaxThreads())},
{"background_move_pool_size", std::to_string(context->getMovesExecutor()->getMaxThreads())},
{"background_fetches_pool_size", std::to_string(context->getFetchesExecutor()->getMaxThreads())},
{"background_common_pool_size", std::to_string(context->getCommonExecutor()->getMaxThreads())},
{"background_buffer_flush_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundBufferFlushSchedulePoolSize))}, {"background_buffer_flush_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundBufferFlushSchedulePoolSize))},
{"background_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundSchedulePoolSize))}, {"background_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundSchedulePoolSize))},
{"background_message_broker_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundMessageBrokerSchedulePoolSize))}, {"background_message_broker_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundMessageBrokerSchedulePoolSize))},
{"background_distributed_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundDistributedSchedulePoolSize))} {"background_distributed_schedule_pool_size", std::to_string(CurrentMetrics::get(CurrentMetrics::BackgroundDistributedSchedulePoolSize))}
}; };
if (context->areBackgroundExecutorsInitialized())
{
updated.insert({"background_pool_size", std::to_string(context->getMergeMutateExecutor()->getMaxThreads())});
updated.insert({"background_move_pool_size", std::to_string(context->getMovesExecutor()->getMaxThreads())});
updated.insert({"background_fetches_pool_size", std::to_string(context->getFetchesExecutor()->getMaxThreads())});
updated.insert({"background_common_pool_size", std::to_string(context->getCommonExecutor()->getMaxThreads())});
}
const auto & config = context->getConfigRef(); const auto & config = context->getConfigRef();
ServerSettings settings; ServerSettings settings;
settings.loadSettingsFromConfig(config); settings.loadSettingsFromConfig(config);

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
$CLICKHOUSE_LOCAL -q "select * from system.server_settings format Null;"