mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #51479 from kssenii/delay-shutdown-of-temporary-database
Delay shutdown of system and temporary databases
This commit is contained in:
commit
73fb47e81f
@ -216,8 +216,22 @@ void DatabaseCatalog::shutdownImpl()
|
|||||||
|
|
||||||
/// We still hold "databases" (instead of std::move) for Buffer tables to flush data correctly.
|
/// 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)
|
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();
|
database.second->shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto & database : databases_with_delayed_shutdown)
|
||||||
|
{
|
||||||
|
database->shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard lock(tables_marked_dropped_mutex);
|
std::lock_guard lock(tables_marked_dropped_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user