Merge pull request #49365 from ClickHouse/ttl_on_insert

Fix bug in removal of existing part directory
This commit is contained in:
alesapin 2023-05-02 11:32:01 +02:00 committed by GitHub
commit 96d2482bff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -463,6 +463,7 @@ void DataPartStorageOnDiskBase::rename(
if (volume->getDisk()->exists(to))
{
/// FIXME it should be logical error
if (remove_new_dir_if_exists)
{
Names files;
@ -473,7 +474,8 @@ void DataPartStorageOnDiskBase::rename(
"Part directory {} already exists and contains {} files. Removing it.",
fullPath(volume->getDisk(), to), files.size());
executeWriteOperation([&](auto & disk) { disk.removeRecursive(to); });
/// Do not remove blobs if they exist
executeWriteOperation([&](auto & disk) { disk.removeSharedRecursive(to, true, {}); });
}
else
{

View File

@ -1330,6 +1330,11 @@ void StorageReplicatedMergeTree::checkParts(bool skip_sanity_checks)
uncovered_unexpected_parts.size(), uncovered_unexpected_parts_rows, unexpected_parts_nonnew, unexpected_parts_nonnew_rows,
parts_to_fetch.size(), parts_to_fetch_blocks, covered_unexpected_parts.size(), unexpected_parts_rows - uncovered_unexpected_parts_rows);
}
else
{
if (!parts_to_fetch.empty())
LOG_DEBUG(log, "Found parts to fetch (exist in zookeeper, but not locally): [{}]", fmt::join(parts_to_fetch, ", "));
}
/// Add to the queue jobs to pick up the missing parts from other replicas and remove from ZK the information that we have them.
queue.setBrokenPartsToEnqueueFetchesOnLoading(std::move(parts_to_fetch));