Skip to content

Commit 290e8f8

Browse files
committed
shadow_link: sort partitions and topics before serializing
.. for consistent output representation
1 parent 030c5ad commit 290e8f8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/v/redpanda/admin/services/shadow_link/converter.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,13 @@ chunked_vector<shadow_topic> create_shadow_topics(
10171017
return model_to_shadow_topic(p.first, p.second, status_report);
10181018
});
10191019

1020+
std::ranges::sort(
1021+
shadow_topics.begin(),
1022+
shadow_topics.end(),
1023+
[](const shadow_topic& a, const shadow_topic& b) {
1024+
return a.get_name() < b.get_name();
1025+
});
1026+
10201027
return shadow_topics;
10211028
}
10221029

@@ -1215,7 +1222,10 @@ chunked_vector<topic_partition_information> status_to_partition_information(
12151222
info.set_high_watermark(report.shadow_partition_high_watermark);
12161223
resp.emplace_back(std::move(info));
12171224
}
1218-
1225+
std::ranges::sort(
1226+
resp,
1227+
std::ranges::less{},
1228+
&topic_partition_information::get_partition_id);
12191229
return resp;
12201230
}
12211231
} // namespace

0 commit comments

Comments
 (0)