mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
avoid using bg pool during non-async start
This commit is contained in:
parent
b8a46ff822
commit
02fc66db10
@ -711,7 +711,6 @@ void LocalServer::processConfig()
|
||||
attachSystemTablesLocal(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::SYSTEM_DATABASE));
|
||||
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA));
|
||||
attachInformationSchema(global_context, *createMemoryDatabaseIfNotExists(global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
|
||||
scheduleLoad(startup_system_tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, startup_system_tasks);
|
||||
|
||||
if (!config().has("only-system-tables"))
|
||||
|
@ -1628,7 +1628,6 @@ try
|
||||
auto load_metadata = loadMetadata(global_context, default_database, server_settings.async_load_databases);
|
||||
/// If we need to convert database engines, disable async tables loading
|
||||
convertDatabasesEnginesIfNeed(load_metadata, global_context);
|
||||
scheduleLoad(system_startup_tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, system_startup_tasks);
|
||||
database_catalog.startupBackgroundCleanup();
|
||||
/// After loading validate that default database exists
|
||||
|
@ -1061,10 +1061,7 @@ TEST(AsyncLoader, RecursiveJob)
|
||||
{
|
||||
int next = --jobs_left;
|
||||
if (next > 0)
|
||||
{
|
||||
auto task = loadAsyncImpl(next);
|
||||
waitLoad(self->pool(), task);
|
||||
}
|
||||
waitLoad(self->pool(), loadAsyncImpl(next));
|
||||
}
|
||||
|
||||
AsyncLoader & loader;
|
||||
|
@ -324,15 +324,8 @@ BlockIO InterpreterCreateQuery::createDatabase(ASTCreateQuery & create)
|
||||
{
|
||||
/// We use global context here, because storages lifetime is bigger than query context lifetime
|
||||
TablesLoader loader{getContext()->getGlobalContext(), {{database_name, database}}, mode};
|
||||
|
||||
auto load_tasks = loader.loadTablesAsync();
|
||||
auto startup_tasks = loader.startupTablesAsync();
|
||||
scheduleLoad(load_tasks);
|
||||
scheduleLoad(startup_tasks);
|
||||
|
||||
auto pool = currentPoolOr(AsyncLoaderPoolId::Foreground);
|
||||
waitLoad(pool, load_tasks);
|
||||
waitLoad(pool, startup_tasks);
|
||||
waitLoad(currentPoolOr(AsyncLoaderPoolId::Foreground), loader.loadTablesAsync());
|
||||
waitLoad(currentPoolOr(AsyncLoaderPoolId::Foreground), loader.startupTablesAsync());
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
@ -389,7 +389,6 @@ static void maybeConvertOrdinaryDatabaseToAtomic(ContextMutablePtr context, cons
|
||||
if (startup_tasks) // NOTE: only for system database
|
||||
{
|
||||
/// It's not quite correct to run DDL queries while database is not started up.
|
||||
scheduleLoad(*startup_tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, *startup_tasks);
|
||||
startup_tasks->clear();
|
||||
}
|
||||
@ -441,20 +440,14 @@ static void maybeConvertOrdinaryDatabaseToAtomic(ContextMutablePtr context, cons
|
||||
{database_name, DatabaseCatalog::instance().getDatabase(database_name)},
|
||||
};
|
||||
TablesLoader loader{context, databases, LoadingStrictnessLevel::FORCE_RESTORE};
|
||||
auto load_tasks = loader.loadTablesAsync();
|
||||
scheduleLoad(load_tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, load_tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, loader.loadTablesAsync());
|
||||
|
||||
/// Startup tables if they were started before conversion and detach/attach
|
||||
if (startup_tasks) // NOTE: only for system database
|
||||
*startup_tasks = loader.startupTablesAsync(); // We have loaded old database(s), replace tasks to startup new database
|
||||
else
|
||||
{
|
||||
// An old database was already loaded, so we should load new one as well
|
||||
auto tasks = loader.startupTablesAsync();
|
||||
scheduleLoad(tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, tasks);
|
||||
}
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, loader.startupTablesAsync());
|
||||
}
|
||||
catch (Exception & e)
|
||||
{
|
||||
@ -509,7 +502,6 @@ LoadTaskPtrs loadMetadataSystem(ContextMutablePtr context)
|
||||
};
|
||||
TablesLoader loader{context, databases, LoadingStrictnessLevel::FORCE_RESTORE};
|
||||
auto tasks = loader.loadTablesAsync();
|
||||
scheduleLoad(tasks);
|
||||
waitLoad(AsyncLoaderPoolId::Foreground, tasks);
|
||||
|
||||
/// Will startup tables in system database after all databases are loaded.
|
||||
|
Loading…
Reference in New Issue
Block a user