Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better logging in background move task. #8192

Merged
merged 2 commits into from
Dec 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion dbms/src/Storages/MergeTree/MergeTreePartsMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ bool MergeTreePartsMover::selectPartsForMove(
const AllowedMovingPredicate & can_move,
const std::lock_guard<std::mutex> & /* 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())
Expand Down Expand Up @@ -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
{
Expand All @@ -165,10 +171,20 @@ 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;
}
}

return !parts_to_move.empty();
if (!parts_to_move.empty())
{
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 true;
}
else
return false;
}

MergeTreeData::DataPartPtr MergeTreePartsMover::clonePart(const MergeTreeMoveEntry & moving_part) const
Expand Down