Skip to content

Commit

Permalink
Merge pull request #23279 from michael-redpanda/CORE-7106-Fix-overall…
Browse files Browse the repository at this point in the history
…oc-describe-log-dirs

kafka: Fixed oversized alloc in describe_log_dirs
  • Loading branch information
dotnwat authored Sep 12, 2024
2 parents 8c1f396 + 7ce5647 commit a9307e5
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit a9307e5

Please sign in to comment.