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.3.x] kafka: Fixed oversized alloc in describe_log_dirs #23292

Merged
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
8 changes: 4 additions & 4 deletions src/v/kafka/server/handlers/describe_log_dirs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct partition_data {
};

using partition_dir_set
= absl::flat_hash_map<model::topic, std::vector<partition_data>>;
= chunked_hash_map<model::topic, chunked_vector<partition_data>>;

static partition_data describe_partition(cluster::partition& p) {
auto result = partition_data{
Expand Down Expand Up @@ -168,20 +168,20 @@ ss::future<response_ptr> describe_log_dirs_handler::handle(

chunked_vector<describe_log_dirs_partition> local_partitions;
chunked_vector<describe_log_dirs_partition> remote_partitions;
for (const auto& i : node.mapped()) {
for (const auto& i : node.second) {
local_partitions.push_back(i.local);
if (i.remote.has_value()) {
remote_partitions.push_back(i.remote.value());
}
}

local_results.topics.push_back(describe_log_dirs_topic{
.name = node.key(),
.name = node.first,
.partitions = std::move(local_partitions),
});
if (!remote_partitions.empty()) {
remote_results.topics.push_back(describe_log_dirs_topic{
.name = std::move(node.key()),
.name = std::move(node.first),
.partitions = std::move(remote_partitions),
});
}
Expand Down
Loading