mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Remove skip_startup_tables from IDatabase::loadStoredObjects()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
6aabb1d94f
commit
8013cb1f78
@ -441,11 +441,10 @@ void DatabaseAtomic::beforeLoadingMetadata(ContextMutablePtr /*context*/, Loadin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseAtomic::loadStoredObjects(
|
void DatabaseAtomic::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
||||||
ContextMutablePtr local_context, LoadingStrictnessLevel mode, bool skip_startup_tables)
|
|
||||||
{
|
{
|
||||||
beforeLoadingMetadata(local_context, mode);
|
beforeLoadingMetadata(local_context, mode);
|
||||||
DatabaseOrdinary::loadStoredObjects(local_context, mode, skip_startup_tables);
|
DatabaseOrdinary::loadStoredObjects(local_context, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseAtomic::startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode)
|
void DatabaseAtomic::startupTables(ThreadPool & thread_pool, LoadingStrictnessLevel mode)
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ DatabaseLazy::DatabaseLazy(const String & name_, const String & metadata_path_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabaseLazy::loadStoredObjects(
|
void DatabaseLazy::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel /*mode*/)
|
||||||
ContextMutablePtr local_context, LoadingStrictnessLevel /*mode*/, bool /* skip_startup_tables */)
|
|
||||||
{
|
{
|
||||||
iterateMetadataFiles(local_context, [this, &local_context](const String & file_name)
|
iterateMetadataFiles(local_context, [this, &local_context](const String & file_name)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
bool canContainDistributedTables() const override { return false; }
|
bool canContainDistributedTables() const override { return false; }
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel /*mode*/, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel /*mode*/) override;
|
||||||
|
|
||||||
void createTable(
|
void createTable(
|
||||||
ContextPtr context,
|
ContextPtr context,
|
||||||
|
@ -89,8 +89,7 @@ DatabaseOrdinary::DatabaseOrdinary(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::loadStoredObjects(
|
void DatabaseOrdinary::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
||||||
ContextMutablePtr local_context, LoadingStrictnessLevel mode, bool skip_startup_tables)
|
|
||||||
{
|
{
|
||||||
/** Tables load faster if they are loaded in sorted (by name) order.
|
/** Tables load faster if they are loaded in sorted (by name) order.
|
||||||
* Otherwise (for the ext4 filesystem), `DirectoryIterator` iterates through them in some order,
|
* Otherwise (for the ext4 filesystem), `DirectoryIterator` iterates through them in some order,
|
||||||
@ -159,12 +158,6 @@ void DatabaseOrdinary::loadStoredObjects(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pool.wait();
|
pool.wait();
|
||||||
|
|
||||||
if (!skip_startup_tables)
|
|
||||||
{
|
|
||||||
/// After all tables was basically initialized, startup them.
|
|
||||||
startupTables(pool, mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTablesMetadata & metadata, bool is_startup)
|
void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTablesMetadata & metadata, bool is_startup)
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
String getEngineName() const override { return "Ordinary"; }
|
String getEngineName() const override { return "Ordinary"; }
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
bool supportsLoadingInTopologicalOrder() const override { return true; }
|
bool supportsLoadingInTopologicalOrder() const override { return true; }
|
||||||
|
|
||||||
|
@ -495,11 +495,10 @@ void DatabaseReplicated::beforeLoadingMetadata(ContextMutablePtr /*context*/, Lo
|
|||||||
tryConnectToZooKeeperAndInitDatabase(mode);
|
tryConnectToZooKeeperAndInitDatabase(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseReplicated::loadStoredObjects(
|
void DatabaseReplicated::loadStoredObjects(ContextMutablePtr local_context, LoadingStrictnessLevel mode)
|
||||||
ContextMutablePtr local_context, LoadingStrictnessLevel mode, bool skip_startup_tables)
|
|
||||||
{
|
{
|
||||||
beforeLoadingMetadata(local_context, mode);
|
beforeLoadingMetadata(local_context, mode);
|
||||||
DatabaseAtomic::loadStoredObjects(local_context, mode, skip_startup_tables);
|
DatabaseAtomic::loadStoredObjects(local_context, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt64 DatabaseReplicated::getMetadataHash(const String & table_name) const
|
UInt64 DatabaseReplicated::getMetadataHash(const String & table_name) const
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
|
|
||||||
void drop(ContextPtr /*context*/) override;
|
void drop(ContextPtr /*context*/) override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
void beforeLoadingMetadata(ContextMutablePtr context, LoadingStrictnessLevel mode) override;
|
||||||
|
|
||||||
|
@ -134,8 +134,7 @@ public:
|
|||||||
/// You can call only once, right after the object is created.
|
/// You can call only once, right after the object is created.
|
||||||
virtual void loadStoredObjects( /// NOLINT
|
virtual void loadStoredObjects( /// NOLINT
|
||||||
ContextMutablePtr /*context*/,
|
ContextMutablePtr /*context*/,
|
||||||
LoadingStrictnessLevel /*mode*/,
|
LoadingStrictnessLevel /*mode*/)
|
||||||
bool /* skip_startup_tables */)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ String DatabaseMySQL::getMetadataPath() const
|
|||||||
return metadata_path;
|
return metadata_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatabaseMySQL::loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/, bool /* skip_startup_tables */)
|
void DatabaseMySQL::loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/)
|
||||||
{
|
{
|
||||||
|
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
void createTable(ContextPtr, const String & table_name, const StoragePtr & storage, const ASTPtr & create_query) override;
|
void createTable(ContextPtr, const String & table_name, const StoragePtr & storage, const ASTPtr & create_query) override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/) override;
|
||||||
|
|
||||||
StoragePtr detachTable(ContextPtr context, const String & table_name) override;
|
StoragePtr detachTable(ContextPtr context, const String & table_name) override;
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ void DatabasePostgreSQL::drop(ContextPtr /*context*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DatabasePostgreSQL::loadStoredObjects(ContextMutablePtr /* context */, LoadingStrictnessLevel /*mode*/, bool /* skip_startup_tables */)
|
void DatabasePostgreSQL::loadStoredObjects(ContextMutablePtr /* context */, LoadingStrictnessLevel /*mode*/)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard lock{mutex};
|
std::lock_guard lock{mutex};
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
bool empty() const override;
|
bool empty() const override;
|
||||||
|
|
||||||
void loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/, bool skip_startup_tables) override;
|
void loadStoredObjects(ContextMutablePtr, LoadingStrictnessLevel /*mode*/) override;
|
||||||
|
|
||||||
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name) const override;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ void TablesLoader::loadTables()
|
|||||||
if (need_resolve_dependencies && database.second->supportsLoadingInTopologicalOrder())
|
if (need_resolve_dependencies && database.second->supportsLoadingInTopologicalOrder())
|
||||||
databases_to_load.push_back(database.first);
|
databases_to_load.push_back(database.first);
|
||||||
else
|
else
|
||||||
database.second->loadStoredObjects(global_context, strictness_mode, /* skip_startup_tables */ true);
|
database.second->loadStoredObjects(global_context, strictness_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (databases_to_load.empty())
|
if (databases_to_load.empty())
|
||||||
|
Loading…
Reference in New Issue
Block a user