mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-11 18:14:03 +00:00
Delete temporary fetch directory if it already exists
It could be left there after a network timeout, a system crash, or checksum issues. The downside of this PR is that it would be harder to debug checksum issues if replication will continuously delete and try to fetch the same part.
This commit is contained in:
parent
6c1e2a0d87
commit
5cd1dc485f
@ -547,7 +547,11 @@ MergeTreeData::MutableDataPartPtr Fetcher::downloadPartToDisk(
|
|||||||
String part_download_path = data.getRelativeDataPath() + part_relative_path + "/";
|
String part_download_path = data.getRelativeDataPath() + part_relative_path + "/";
|
||||||
|
|
||||||
if (disk->exists(part_download_path))
|
if (disk->exists(part_download_path))
|
||||||
throw Exception("Directory " + fullPath(disk, part_download_path) + " already exists.", ErrorCodes::DIRECTORY_ALREADY_EXISTS);
|
{
|
||||||
|
LOG_WARNING(log, "Directory {} already exists, probably result of a failed fetch. Will remove it before fetching part.",
|
||||||
|
fullPath(disk, part_download_path));
|
||||||
|
disk->removeRecursive(part_download_path);
|
||||||
|
}
|
||||||
|
|
||||||
disk->createDirectories(part_download_path);
|
disk->createDirectories(part_download_path);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user