Skip to content

Commit

Permalink
Merge pull request #9965 from vbotbuildovich/backport-fixes-to-v23.1.…
Browse files Browse the repository at this point in the history
…x-711

[v23.1.x] kafka: Usage manager bugfixes
  • Loading branch information
michael-redpanda authored Apr 11, 2023
2 parents 897dd9e + f29a054 commit 74c0157
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/v/cluster/health_monitor_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ cluster_health_report health_monitor_backend::build_cluster_report(
return cluster_health_report{
.raft0_leader = _raft0->get_leader_id(),
.node_states = std::move(statuses),
.node_reports = std::move(reports)};
.node_reports = std::move(reports),
.bytes_in_cloud_storage = _bytes_in_cloud_storage};
}

void health_monitor_backend::refresh_nodes_status() {
Expand Down Expand Up @@ -379,6 +380,7 @@ health_monitor_backend::dispatch_refresh_cluster_health_request(
_reports.emplace(id, std::move(n_report));
}

_bytes_in_cloud_storage = reply.value().report->bytes_in_cloud_storage;
_reports_disk_health = cluster_disk_health;
_last_refresh = ss::lowres_clock::now();
co_return make_error_code(errc::success);
Expand Down
2 changes: 1 addition & 1 deletion src/v/kafka/server/usage_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ ss::future<> usage_manager::reset() {
oncore_debug_verify(_verify_shard);
try {
auto h = _background_gate.hold();
auto u = _background_mutex.get_units();
auto u = co_await _background_mutex.get_units();
if (_accounting_fiber) {
/// Deallocate the accounting_fiber if the feature is disabled,
/// otherwise it will keep in memory the number of configured
Expand Down
9 changes: 5 additions & 4 deletions tests/rptest/tests/usage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,16 @@ def check_usage():
manifest_usage = self.admin.cloud_storage_usage()
reported_usage = self.admin.get_usage(
random.choice(self.redpanda.nodes))
reported_usage = max(
[x['cloud_storage_bytes_gauge'] for x in reported_usage])
reported_usages = [
x['cloud_storage_bytes_gauge'] for x in reported_usage
]

self.logger.info(
f"Expected {manifest_usage} bytes of cloud storage usage")
self.logger.info(
f"Max reported usages via kafka/usage_manager: {reported_usage}"
f"Max reported usages via kafka/usage_manager: {max(reported_usages)}"
)
return reported_usage == manifest_usage
return manifest_usage in reported_usages

wait_until(
check_usage,
Expand Down

0 comments on commit 74c0157

Please sign in to comment.