From 9393bb0f12c85a2bb5edd8f8ee13164b4f277741 Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Fri, 13 Dec 2019 00:34:57 +0300 Subject: [PATCH] Better logging in background move task. --- dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp b/dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp index 7fe7b01cd92..d4937eb4e05 100644 --- a/dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp @@ -89,6 +89,10 @@ bool MergeTreePartsMover::selectPartsForMove( const AllowedMovingPredicate & can_move, const std::lock_guard & /* moving_parts_lock */) { + unsigned parts_to_move_by_policy_rules = 0; + unsigned parts_to_move_by_ttl_rules = 0; + double parts_to_move_total_size_bytes = 0.0; + MergeTreeData::DataPartsVector data_parts = data->getDataPartsVector(); if (data_parts.empty()) @@ -143,6 +147,8 @@ bool MergeTreePartsMover::selectPartsForMove( { to_insert->second.decreaseRequiredSizeAndRemoveRedundantParts(part->bytes_on_disk); } + ++parts_to_move_by_ttl_rules; + parts_to_move_total_size_bytes += part->bytes_on_disk; } else { @@ -165,9 +171,15 @@ bool MergeTreePartsMover::selectPartsForMove( break; } parts_to_move.emplace_back(part, std::move(reservation)); + ++parts_to_move_by_policy_rules; + parts_to_move_total_size_bytes += part->bytes_on_disk; } } + LOG_TRACE(log, "Selected " << parts_to_move_by_policy_rules << " parts to move according to storage policy rules and " + << parts_to_move_by_ttl_rules << " parts according to TTL rules, " + << formatReadableSizeWithBinarySuffix(parts_to_move_total_size_bytes) << " total"); + return !parts_to_move.empty(); }