From efa73608b8a09f821bf225ee5f708f1edae24e04 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Mon, 18 Nov 2019 11:42:46 +0300 Subject: [PATCH] Separated constant path to DeleteOnDestroy marker. --- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index f6a901c2cb2..00762cc4254 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -96,6 +96,12 @@ namespace ErrorCodes } +namespace +{ + const char * DELETE_ON_DESTROY_MARKER_PATH = "delete-on-destroy.txt"; +} + + MergeTreeData::MergeTreeData( const String & database_, const String & table_, @@ -760,7 +766,7 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks) if (startsWith(it.name(), "tmp")) continue; - if (Poco::Path(it.path(), "delete-on-destroy.txt").isFile()) + if (Poco::Path(it.path(), DELETE_ON_DESTROY_MARKER_PATH).isFile()) { it->remove(true); continue; @@ -2535,14 +2541,15 @@ void MergeTreeData::swapActivePart(MergeTreeData::DataPartPtr part_copy) auto part_it = data_parts_indexes.insert(part_copy).first; modifyPartState(part_it, DataPartState::Committed); + Poco::Path marker_path(Poco::Path(original_active_part->getFullPath()), DELETE_ON_DESTROY_MARKER_PATH); try { - Poco::File(original_active_part->getFullPath() + "/delete-on-destroy.txt").createFile(); + Poco::File(marker_path).createFile(); } catch (...) { LOG_WARNING(log, "Exception has occurred while creating DeleteOnDestroy marker: '" - << original_active_part->getFullPath() + "/delete-on-destroy.txt'."); + << marker_path.toString() + "'."); } return; }