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

[v23.1.x] kafka: Usage manager bugfixes #9965

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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