fix a race condition

This commit is contained in:
Alexander Tokmakov 2023-02-16 14:41:18 +01:00
parent a96d6af17e
commit 9feb448a5e
4 changed files with 4 additions and 4 deletions

View File

@ -654,8 +654,8 @@ void LocalServer::processConfig()
if (!config().has("only-system-tables"))
{
DatabaseCatalog::instance().startupBackgroundCleanup();
loadMetadata(global_context);
DatabaseCatalog::instance().loadDatabases();
}
/// For ClickHouse local if path is not set the loader will be disabled.

View File

@ -1656,11 +1656,11 @@ try
/// that may execute DROP before loadMarkedAsDroppedTables() in background,
/// and so loadMarkedAsDroppedTables() will find it and try to add, and UUID will overlap.
database_catalog.loadMarkedAsDroppedTables();
database_catalog.startupBackgroundCleanup();
/// Then, load remaining databases
loadMetadata(global_context, default_database);
convertDatabasesEnginesIfNeed(global_context);
startupSystemTables();
database_catalog.loadDatabases();
/// After loading validate that default database exists
database_catalog.assertDatabaseExists(default_database);
/// Load user-defined SQL functions.

View File

@ -152,7 +152,7 @@ void DatabaseCatalog::initializeAndLoadTemporaryDatabase()
attachDatabase(TEMPORARY_DATABASE, db_for_temporary_and_external_tables);
}
void DatabaseCatalog::loadDatabases()
void DatabaseCatalog::startupBackgroundCleanup()
{
if (Context::getGlobalContextInstance()->getApplicationType() == Context::ApplicationType::SERVER && unused_dir_cleanup_period_sec)
{

View File

@ -136,7 +136,7 @@ public:
static void shutdown();
void initializeAndLoadTemporaryDatabase();
void loadDatabases();
void startupBackgroundCleanup();
void loadMarkedAsDroppedTables();
/// Get an object that protects the table from concurrently executing multiple DDL operations.