mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Done
This commit is contained in:
parent
2d24614b05
commit
ab97c60118
@ -30,6 +30,8 @@
|
||||
#include <Common/Macros.h>
|
||||
#include <base/chrono_io.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
namespace ErrorCodes
|
||||
@ -862,7 +864,19 @@ void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeep
|
||||
for (const auto & id : dropped_tables)
|
||||
DatabaseCatalog::instance().waitTableFinallyDropped(id);
|
||||
|
||||
for (const auto & name_and_meta : table_name_to_metadata)
|
||||
/// FIXME: Use proper dependency calculation instead of just moving MV to the end
|
||||
using NameToMetadata = std::pair<String, String>;
|
||||
std::vector<NameToMetadata> table_name_to_metadata_sorted;
|
||||
table_name_to_metadata_sorted.reserve(table_name_to_metadata.size());
|
||||
std::move(table_name_to_metadata.begin(), table_name_to_metadata.end(), std::back_inserter(table_name_to_metadata_sorted));
|
||||
std::sort(table_name_to_metadata_sorted.begin(), table_name_to_metadata_sorted.end(), [](const NameToMetadata & lhs, const NameToMetadata & rhs) -> bool
|
||||
{
|
||||
const bool is_materialized_view_lhs = lhs.second.find("MATERIALIZED") != std::string::npos;
|
||||
const bool is_materialized_view_rhs = rhs.second.find("MATERIALIZED") != std::string::npos;
|
||||
return is_materialized_view_lhs < is_materialized_view_rhs;
|
||||
});
|
||||
|
||||
for (const auto & name_and_meta : table_name_to_metadata_sorted)
|
||||
{
|
||||
if (isTableExist(name_and_meta.first, getContext()))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user