Skip to content

Commit

Permalink
DNM add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ztlpn committed Sep 23, 2023
1 parent 6f6bb9a commit a7eb66d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/v/cluster/health_monitor_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,14 @@ ss::chunked_fifo<ntp_report> collect_shard_local_reports(
} else {
for (const auto& [ntp, partition] : pm.partitions()) {
if (filters.matches(ntp)) {
vlog(
clusterlog.info,
"SIZE ntp:{} s:{} nls:{} tot:{}",
ntp,
partition->size_bytes(),
partition->non_log_disk_size_bytes(),
partition->size_bytes(),
partition->non_log_disk_size_bytes());
reports.push_back(ntp_report{
.ntp = ntp,
.leader = ntp_leader{
Expand Down
23 changes: 23 additions & 0 deletions src/v/cluster/partition_balancer_planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,12 @@ partition_balancer_planner::reassignable_partition::move_replica(
auto from_it = _ctx.node_disk_reports.find(replica);
if (from_it != _ctx.node_disk_reports.end()) {
from_it->second.released += _sizes.get_current(replica);

vlog(
clusterlog.debug,
"moving from: {}, updated disk: {}",
replica,
from_it->second);
}

auto to_it = _ctx.node_disk_reports.find(new_node);
Expand All @@ -959,6 +965,12 @@ partition_balancer_planner::reassignable_partition::move_replica(
} else {
to_it->second.assigned += _sizes.non_reclaimable;
}

vlog(
clusterlog.debug,
"moving to: {}, updated disk: {}",
new_node,
to_it->second);
}
}

Expand Down Expand Up @@ -1549,6 +1561,17 @@ partition_balancer_planner::plan_actions(

co_await init_ntp_sizes_from_health_report(health_report, ctx);

for (model::node_id id : ctx.all_nodes) {
auto disk_it = ctx.node_disk_reports.find(id);
if (disk_it == ctx.node_disk_reports.end()) {
vlog(clusterlog.info, "node {}: no disk report", id);
continue;
}

const auto& disk = disk_it->second;
vlog(clusterlog.debug, "node {} disk: {}", id, disk);
}

co_await get_node_drain_actions(
ctx, ctx.decommissioning_nodes, change_reason::node_decommissioning);

Expand Down
15 changes: 15 additions & 0 deletions src/v/cluster/partition_balancer_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "model/metadata.h"
#include "model/timestamp.h"
#include "serde/serde.h"
#include "utils/human.h"
#include "utils/to_string.h"

#include <absl/container/btree_set.h>
Expand Down Expand Up @@ -45,6 +46,20 @@ struct node_disk_space {
double final_used_ratio() const {
return double(used + assigned - released) / total;
}

friend std::ostream& operator<<(std::ostream& o, const node_disk_space& d) {
fmt::print(
o,
"{{bu: {}, ba: {}, br: {}, orig ur: {:.4}, peak ur: {:.4}, final ur: "
"{:.4}}}",
human::bytes(d.used),
human::bytes(d.assigned),
human::bytes(d.released),
d.original_used_ratio(),
d.peak_used_ratio(),
d.final_used_ratio());
return o;
}
};

struct partition_balancer_violations
Expand Down

0 comments on commit a7eb66d

Please sign in to comment.