From 4b9488be409eabe2745f667eed626fbf5cc9a9d2 Mon Sep 17 00:00:00 2001 From: Anton Ivashkin Date: Fri, 21 May 2021 16:05:12 +0300 Subject: [PATCH] Add log record for removed from AWS S3 keys --- src/Disks/S3/DiskS3.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Disks/S3/DiskS3.cpp b/src/Disks/S3/DiskS3.cpp index 325e887073c..1a347394012 100644 --- a/src/Disks/S3/DiskS3.cpp +++ b/src/Disks/S3/DiskS3.cpp @@ -54,6 +54,7 @@ class DiskS3::AwsS3KeyKeeper : public std::list & chunk); private: /// limit for one DeleteObject request @@ -74,6 +75,19 @@ void DiskS3::AwsS3KeyKeeper::addKey(const String & key) back().push_back(obj); } +String DiskS3::AwsS3KeyKeeper::getChunkKeys(const Aws::Vector & chunk) +{ + String res; + for (const auto & obj : chunk) + { + const auto & key = obj.GetKey(); + if (!res.empty()) + res.append(", "); + res.append(key.c_str(), key.size()); + } + return res; +} + String getRandomName() { std::uniform_int_distribution distribution('a', 'z'); @@ -794,6 +808,8 @@ void DiskS3::removeAws(const AwsS3KeyKeeper & keys) for (const auto & chunk : keys) { + LOG_DEBUG(log, "Remove AWS keys {}", AwsS3KeyKeeper::getChunkKeys(chunk)); + Aws::S3::Model::Delete delkeys; delkeys.SetObjects(chunk);