mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Better
This commit is contained in:
parent
d34d752688
commit
ab9d5d8cc7
@ -579,11 +579,6 @@ void LocalServer::processConfig()
|
||||
{
|
||||
String path = global_context->getPath();
|
||||
|
||||
/// When tables are loaded from .sql we initialize background executors
|
||||
/// regardless there are MergeTree tables or not, because no better place was found.
|
||||
/// In other cases it will be initialized only when there are mergeTree tables.
|
||||
global_context->initializeBackgroundExecutors();
|
||||
|
||||
/// Lock path directory before read
|
||||
status.emplace(fs::path(path) / "status", StatusFile::write_full_info);
|
||||
|
||||
|
@ -53,6 +53,15 @@ std::pair<String, StoragePtr> createTableFromAST(
|
||||
ast_create_query.attach = true;
|
||||
ast_create_query.database = database_name;
|
||||
|
||||
auto global_context = context->getGlobalContext();
|
||||
if (global_context
|
||||
&& global_context->getApplicationType() == Context::ApplicationType::LOCAL
|
||||
&& !global_context->isBackgroundExecutorsInitialized()
|
||||
&& ast_create_query.storage && endsWith(ast_create_query.storage->engine->name, "MergeTree"))
|
||||
{
|
||||
global_context->initializeBackgroundExecutors();
|
||||
}
|
||||
|
||||
if (ast_create_query.as_table_function)
|
||||
{
|
||||
const auto & factory = TableFunctionFactory::instance();
|
||||
|
@ -161,7 +161,7 @@ void loadMetadata(ContextMutablePtr context, const String & default_database_nam
|
||||
bool create_default_db_if_not_exists = !default_database_name.empty();
|
||||
bool metadata_dir_for_default_db_already_exists = databases.count(default_database_name);
|
||||
if (create_default_db_if_not_exists && !metadata_dir_for_default_db_already_exists)
|
||||
databases.emplace(default_database_name, path + "/" + escapeForFileName(default_database_name));
|
||||
databases.emplace(default_database_name, std::filesystem::path(path) / escapeForFileName(default_database_name));
|
||||
|
||||
TablesLoader::Databases loaded_databases;
|
||||
for (const auto & [name, db_path] : databases)
|
||||
|
Loading…
Reference in New Issue
Block a user