Fix unexpected part path check

This commit is contained in:
Кирилл Гарбар 2024-09-08 22:22:06 +03:00
parent 35e263a420
commit b232205b44

View File

@ -582,7 +582,7 @@ bool ReplicatedMergeTreeSinkImpl<false>::writeExistingPart(MergeTreeData::Mutabl
if (deduplicate && deduplicated)
{
error = ErrorCodes::INSERT_WAS_DEDUPLICATED;
if (!startsWith(part->getDataPartStorage().getRelativePath(), "detached/attaching_"))
if (!endsWith(part->getDataPartStorage().getRelativePath(), "detached/attaching_" + part->name + "/"))
throw Exception(ErrorCodes::LOGICAL_ERROR, "Unexpected relative path for a part: {}", part->getDataPartStorage().getRelativePath());
fs::path new_relative_path = fs::path("detached") / part->getNewName(part->info);
part->renameTo(new_relative_path, false);