Merge pull request #51479 from kssenii/delay-shutdown-of-temporary-database

Delay shutdown of system and temporary databases
This commit is contained in:
robot-clickhouse-ci-1 2023-06-28 06:20:46 +02:00 committed by GitHub
commit 73fb47e81f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,8 +216,22 @@ void DatabaseCatalog::shutdownImpl()
/// We still hold "databases" (instead of std::move) for Buffer tables to flush data correctly.
/// Delay shutdown of temporary and system databases. They will be shutdown last.
std::vector<DatabasePtr> databases_with_delayed_shutdown;
for (auto & database : current_databases)
{
if (database.first == TEMPORARY_DATABASE || database.first == SYSTEM_DATABASE)
{
databases_with_delayed_shutdown.push_back(database.second);
continue;
}
database.second->shutdown();
}
for (auto & database : databases_with_delayed_shutdown)
{
database->shutdown();
}
{
std::lock_guard lock(tables_marked_dropped_mutex);