mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Use vector instead of a map
This commit is contained in:
parent
5894fa9860
commit
3b03aea16b
@ -1094,12 +1094,12 @@ void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeep
|
||||
tables_dependencies.checkNoCyclicDependencies();
|
||||
|
||||
auto allow_concurrent_table_creation = getContext()->getServerSettings().max_database_replicated_create_table_thread_pool_size > 1;
|
||||
auto tables_to_create_by_level = tables_dependencies.getTablesSortedByDependencyWithLevels();
|
||||
auto tables_to_create_by_level = tables_dependencies.getTablesSplitByDependencyLevel();
|
||||
|
||||
auto create_tables_runner = threadPoolCallbackRunner<void>(getDatabaseReplicatedCreateTablesThreadPool().get(), "CreateTables");
|
||||
std::vector<std::future<void>> create_table_futures;
|
||||
|
||||
for (const auto & [_, tables_to_create] : tables_to_create_by_level)
|
||||
for (const auto & tables_to_create : tables_to_create_by_level)
|
||||
{
|
||||
for (const auto & table_id : tables_to_create)
|
||||
{
|
||||
|
@ -699,14 +699,14 @@ std::vector<StorageID> TablesDependencyGraph::getTablesSortedByDependency() cons
|
||||
}
|
||||
|
||||
|
||||
std::map<size_t, std::vector<StorageID>> TablesDependencyGraph::getTablesSortedByDependencyWithLevels() const
|
||||
std::vector<std::vector<StorageID>> TablesDependencyGraph::getTablesSplitByDependencyLevel() const
|
||||
{
|
||||
std::map<size_t, std::vector<StorageID>> tables_by_level;
|
||||
std::vector<std::vector<StorageID>> tables_split_by_level;
|
||||
for (const auto * node : getNodesSortedByLevel())
|
||||
{
|
||||
tables_by_level[node->level].emplace_back(node->storage_id);
|
||||
tables_split_by_level[node->level].emplace_back(node->storage_id);
|
||||
}
|
||||
return tables_by_level;
|
||||
return tables_split_by_level;
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,11 +107,11 @@ public:
|
||||
/// tables which depend on the tables which depend on the tables without dependencies, and so on.
|
||||
std::vector<StorageID> getTablesSortedByDependency() const;
|
||||
|
||||
/// Returns a map of lists of tables by the number of dependencies they have:
|
||||
/// tables without dependencies first with level 0, then
|
||||
/// tables with depend on the tables without dependencies with level 1, then
|
||||
/// tables which depend on the tables which depend on the tables without dependencies with level 2, and so on.
|
||||
std::map<size_t, std::vector<StorageID>> getTablesSortedByDependencyWithLevels() const;
|
||||
/// Returns a list of lists of tables by the number of dependencies they have:
|
||||
/// tables without dependencies are in the first list, then
|
||||
/// tables which depend on the tables without dependencies are in the second list, then
|
||||
/// tables which depend on the tables which depend on the tables without dependencies are in the third list, and so on.
|
||||
std::vector<std::vector<StorageID>> getTablesSplitByDependencyLevel() const;
|
||||
|
||||
/// Outputs information about this graph as a bunch of logging messages.
|
||||
void log() const;
|
||||
|
Loading…
Reference in New Issue
Block a user