Merge pull request #66240 from azat/ATTACH-ignore-async_load_databases

Ignore async_load_databases for ATTACH query
This commit is contained in:
Sergei Trifonov 2024-07-31 17:20:10 +00:00 committed by GitHub
commit a38c2e558b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 14 deletions

View File

@ -361,18 +361,10 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create)
TablesLoader loader{getContext()->getGlobalContext(), {{database_name, database}}, mode};
auto load_tasks = loader.loadTablesAsync();
auto startup_tasks = loader.startupTablesAsync();
if (getContext()->getGlobalContext()->getServerSettings().async_load_databases)
{
scheduleLoad(load_tasks);
scheduleLoad(startup_tasks);
}
else
{
/// First prioritize, schedule and wait all the load table tasks
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), load_tasks);
/// Only then prioritize, schedule and wait all the startup tasks
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), startup_tasks);
}
/// First prioritize, schedule and wait all the load table tasks
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), load_tasks);
/// Only then prioritize, schedule and wait all the startup tasks
waitLoad(currentPoolOr(TablesLoaderForegroundPoolId), startup_tasks);
}
}
catch (...)

View File

@ -1,4 +1,4 @@
NOT_LOADED
0 NOT_LOADED
0 LOADED
10
1 LOADED

View File

@ -12,7 +12,7 @@ LAYOUT(FLAT());
DETACH DATABASE {CLICKHOUSE_DATABASE:Identifier};
ATTACH DATABASE {CLICKHOUSE_DATABASE:Identifier};
SELECT COALESCE((SELECT status FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict')::Nullable(String), 'NOT_LOADED');
SELECT query_count, status FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict';
SYSTEM RELOAD DICTIONARY dict;
SELECT query_count, status FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict';
SELECT dictGetUInt64('dict', 'val', toUInt64(0));