mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #62232 from Algunenano/paranoid
Include table name in paranoid checks
This commit is contained in:
commit
1f1a0ff7d4
@ -1524,8 +1524,13 @@ void StorageReplicatedMergeTree::paranoidCheckForCoveredPartsInZooKeeperOnStart(
|
||||
|
||||
if (!found)
|
||||
{
|
||||
LOG_WARNING(log, "Part {} exists in ZooKeeper and covered by another part in ZooKeeper ({}), but doesn't exist on any disk. "
|
||||
"It may cause false-positive 'part is lost forever' messages", part_name, covering_part);
|
||||
LOG_WARNING(
|
||||
log,
|
||||
"Part {} of table {} exists in ZooKeeper and covered by another part in ZooKeeper ({}), but doesn't exist on any disk. "
|
||||
"It may cause false-positive 'part is lost forever' messages",
|
||||
part_name,
|
||||
getStorageID().getNameForLogs(),
|
||||
covering_part);
|
||||
ProfileEvents::increment(ProfileEvents::ReplicatedCoveredPartsInZooKeeperOnStart);
|
||||
chassert(false);
|
||||
}
|
||||
@ -2351,8 +2356,12 @@ MergeTreeData::MutableDataPartPtr StorageReplicatedMergeTree::executeFetchShared
|
||||
}
|
||||
}
|
||||
|
||||
static void paranoidCheckForCoveredPartsInZooKeeper(const ZooKeeperPtr & zookeeper, const String & replica_path,
|
||||
MergeTreeDataFormatVersion format_version, const String & covering_part_name)
|
||||
static void paranoidCheckForCoveredPartsInZooKeeper(
|
||||
const ZooKeeperPtr & zookeeper,
|
||||
const String & replica_path,
|
||||
MergeTreeDataFormatVersion format_version,
|
||||
const String & covering_part_name,
|
||||
const StorageReplicatedMergeTree & storage)
|
||||
{
|
||||
#ifdef ABORT_ON_LOGICAL_ERROR
|
||||
constexpr bool paranoid_check_for_covered_parts_default = true;
|
||||
@ -2371,8 +2380,12 @@ static void paranoidCheckForCoveredPartsInZooKeeper(const ZooKeeperPtr & zookeep
|
||||
{
|
||||
auto part_info = MergeTreePartInfo::fromPartName(part_name, format_version);
|
||||
if (drop_range_info.contains(part_info))
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
"Part {} remains in ZooKeeper after DROP_RANGE {}", part_name, covering_part_name);
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Part {} from table {} remains in ZooKeeper after DROP_RANGE {}",
|
||||
part_name,
|
||||
storage.getStorageID().getNameForLogs(),
|
||||
covering_part_name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2434,7 +2447,7 @@ void StorageReplicatedMergeTree::executeDropRange(const LogEntry & entry)
|
||||
|
||||
/// Forcibly remove parts from ZooKeeper
|
||||
removePartsFromZooKeeperWithRetries(parts_to_remove);
|
||||
paranoidCheckForCoveredPartsInZooKeeper(getZooKeeper(), replica_path, format_version, entry.new_part_name);
|
||||
paranoidCheckForCoveredPartsInZooKeeper(getZooKeeper(), replica_path, format_version, entry.new_part_name, *this);
|
||||
|
||||
if (entry.detach)
|
||||
LOG_DEBUG(log, "Detached {} parts inside {}.", parts_to_remove.size(), entry.new_part_name);
|
||||
@ -2572,7 +2585,8 @@ bool StorageReplicatedMergeTree::executeReplaceRange(LogEntry & entry)
|
||||
LOG_INFO(log, "All parts from REPLACE PARTITION command have been already attached");
|
||||
removePartsFromZooKeeperWithRetries(parts_to_remove);
|
||||
if (replace)
|
||||
paranoidCheckForCoveredPartsInZooKeeper(getZooKeeper(), replica_path, format_version, entry_replace.drop_range_part_name);
|
||||
paranoidCheckForCoveredPartsInZooKeeper(
|
||||
getZooKeeper(), replica_path, format_version, entry_replace.drop_range_part_name, *this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2893,7 +2907,7 @@ bool StorageReplicatedMergeTree::executeReplaceRange(LogEntry & entry)
|
||||
|
||||
removePartsFromZooKeeperWithRetries(parts_to_remove);
|
||||
if (replace)
|
||||
paranoidCheckForCoveredPartsInZooKeeper(getZooKeeper(), replica_path, format_version, entry_replace.drop_range_part_name);
|
||||
paranoidCheckForCoveredPartsInZooKeeper(getZooKeeper(), replica_path, format_version, entry_replace.drop_range_part_name, *this);
|
||||
res_parts.clear();
|
||||
parts_to_remove.clear();
|
||||
cleanup_thread.wakeup();
|
||||
|
Loading…
Reference in New Issue
Block a user