mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Parse metadata stored in zookeeper before checking for equality
After #11325 trailing whitespaces has been removed for data skipping indicies, and it may be different, if you have multiple skip indices, and in this case new server will not load such tables, because metadata will be different. Fix this by re-parse metadata in zookeeper.
This commit is contained in:
parent
ac93f2795c
commit
caa88777be
@ -210,7 +210,7 @@ void ReplicatedMergeTreeTableMetadata::checkImmutableFieldsEquals(const Replicat
|
||||
|
||||
}
|
||||
|
||||
void ReplicatedMergeTreeTableMetadata::checkEquals(const ReplicatedMergeTreeTableMetadata & from_zk) const
|
||||
void ReplicatedMergeTreeTableMetadata::checkEquals(const ReplicatedMergeTreeTableMetadata & from_zk, const ColumnsDescription & columns, const Context & context) const
|
||||
{
|
||||
|
||||
checkImmutableFieldsEquals(from_zk);
|
||||
@ -232,20 +232,24 @@ void ReplicatedMergeTreeTableMetadata::checkEquals(const ReplicatedMergeTreeTabl
|
||||
ErrorCodes::METADATA_MISMATCH);
|
||||
}
|
||||
|
||||
if (skip_indices != from_zk.skip_indices)
|
||||
String parsed_zk_skip_indices = IndicesDescription::parse(from_zk.skip_indices, columns, context).toString();
|
||||
if (skip_indices != parsed_zk_skip_indices)
|
||||
{
|
||||
throw Exception(
|
||||
"Existing table metadata in ZooKeeper differs in skip indexes."
|
||||
" Stored in ZooKeeper: " + from_zk.skip_indices +
|
||||
", parsed from ZooKeeper: " + parsed_zk_skip_indices +
|
||||
", local: " + skip_indices,
|
||||
ErrorCodes::METADATA_MISMATCH);
|
||||
}
|
||||
|
||||
if (constraints != from_zk.constraints)
|
||||
String parsed_zk_constraints = ConstraintsDescription::parse(from_zk.constraints).toString();
|
||||
if (constraints != parsed_zk_constraints)
|
||||
{
|
||||
throw Exception(
|
||||
"Existing table metadata in ZooKeeper differs in constraints."
|
||||
" Stored in ZooKeeper: " + from_zk.constraints +
|
||||
", parsed from ZooKeeper: " + parsed_zk_constraints +
|
||||
", local: " + constraints,
|
||||
ErrorCodes::METADATA_MISMATCH);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ struct ReplicatedMergeTreeTableMetadata
|
||||
}
|
||||
};
|
||||
|
||||
void checkEquals(const ReplicatedMergeTreeTableMetadata & from_zk) const;
|
||||
void checkEquals(const ReplicatedMergeTreeTableMetadata & from_zk, const ColumnsDescription & columns, const Context & context) const;
|
||||
|
||||
Diff checkAndFindDiff(const ReplicatedMergeTreeTableMetadata & from_zk) const;
|
||||
|
||||
|
@ -741,7 +741,7 @@ void StorageReplicatedMergeTree::checkTableStructure(const String & zookeeper_pr
|
||||
Coordination::Stat metadata_stat;
|
||||
String metadata_str = zookeeper->get(zookeeper_prefix + "/metadata", &metadata_stat);
|
||||
auto metadata_from_zk = ReplicatedMergeTreeTableMetadata::parse(metadata_str);
|
||||
old_metadata.checkEquals(metadata_from_zk);
|
||||
old_metadata.checkEquals(metadata_from_zk, getColumns(), global_context);
|
||||
|
||||
Coordination::Stat columns_stat;
|
||||
auto columns_from_zk = ColumnsDescription::parse(zookeeper->get(zookeeper_prefix + "/columns", &columns_stat));
|
||||
|
Loading…
Reference in New Issue
Block a user