"Atomically" remove parts on destroy.

This commit is contained in:
Vladimir Chebotarev 2019-12-26 01:13:00 +03:00
parent 4363ce6976
commit 3f11569d94

View File

@ -345,6 +345,10 @@ MergeTreeDataPart::~MergeTreeDataPart()
}
}
/// "Atomically" remove directory, leaving no inconsistent state.
Poco::Path source_path(path);
Poco::Path destination_path(path, "../stale_" + source_path.getBaseName());
dir.renameTo(destination_path.toString());
dir.remove(true);
if (state == State::DeleteOnDestroy)