From 6da37b92e12e0072ad4f87a2ab952d151553dc36 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 8 Sep 2022 13:11:53 +0200 Subject: [PATCH] Improve logging one time --- src/IO/ReadBufferFromS3.cpp | 2 +- src/Storages/MergeTree/MergeTreeData.cpp | 6 +++--- src/Storages/StorageReplicatedMergeTree.cpp | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/IO/ReadBufferFromS3.cpp b/src/IO/ReadBufferFromS3.cpp index 7e02addd21c..380365f9b95 100644 --- a/src/IO/ReadBufferFromS3.cpp +++ b/src/IO/ReadBufferFromS3.cpp @@ -142,7 +142,7 @@ bool ReadBufferFromS3::nextImpl() /// It doesn't make sense to retry Access Denied or No Such Key if (!s3_exception->isRetryableError()) { - tryLogCurrentException(log); + tryLogCurrentException(log, fmt::format("while reading key: {}, from bucket: {}", key, bucket)); throw; } } diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index f73e0357735..b04d47cc2d4 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -1046,12 +1046,12 @@ void MergeTreeData::loadDataPartsFromDisk( throw; broken = true; - tryLogCurrentException(__PRETTY_FUNCTION__, fmt::format("while loading part {} on path {}", part->name, part_path)); + tryLogCurrentException(log, fmt::format("while loading part {} on path {}", part->name, part_path)); } catch (...) { broken = true; - tryLogCurrentException(__PRETTY_FUNCTION__, fmt::format("while loading part {} on path {}", part->name, part_path)); + tryLogCurrentException(log, fmt::format("while loading part {} on path {}", part->name, part_path)); } /// Ignore broken parts that can appear as a result of hard server restart. @@ -1065,7 +1065,7 @@ void MergeTreeData::loadDataPartsFromDisk( } catch (...) { - tryLogCurrentException(__PRETTY_FUNCTION__, fmt::format("while calculating part size {} on path {}", part->name, part_path)); + tryLogCurrentException(log, fmt::format("while calculating part size {} on path {}", part->name, part_path)); } std::string part_size_str = "failed to calculate size"; diff --git a/src/Storages/StorageReplicatedMergeTree.cpp b/src/Storages/StorageReplicatedMergeTree.cpp index 4cd0d5fc636..0b05428ceaf 100644 --- a/src/Storages/StorageReplicatedMergeTree.cpp +++ b/src/Storages/StorageReplicatedMergeTree.cpp @@ -7543,6 +7543,9 @@ std::pair StorageReplicatedMergeTree::unlockSharedData(const IMer if (!settings->allow_remote_fs_zero_copy_replication) return std::make_pair(true, NameSet{}); + if (!part.data_part_storage) + LOG_WARNING(log, "Datapart storage for part {} (temp: {}) is not initialzied", part.name, part.is_temp); + if (!part.data_part_storage || !part.isStoredOnDisk()) { LOG_TRACE(log, "Part {} is not stored on disk, blobs can be removed", part.name);