thrift-0002 + victoria-metrics-0002 + pulsar-0007 unit + kafka-0010 fix

thrift-0002: t_cpp_generator::is_struct_storage_not_throwing() vector<t_field*>
  member deduplication uses std::find O(M²) — fix with unordered_set

victoria-metrics-0002: MetricName RemoveTagsOn/RemoveTagsIgnoring hasTag()
  O(T×I) linear scan inside per-metric loop — fix with map-based tag set

pulsar-0007: ModularLoadManagerImpl.reapDeadBrokerPreallocations() takes
  List<String> aliveBrokers, calls contains() O(B) per broker — fix with HashSet

kafka-0010: fix unit test worst-case ordering (shared-topic last for slow path)
This commit is contained in:
russell@unturf.com 2026-03-29 22:25:29 -04:00
parent ba818693db
commit a922a7ee9d
6 changed files with 577 additions and 2 deletions

View file

@ -36,10 +36,12 @@ public class Kafka0010RoundRobinAssignorTest {
List<List<String>> consumerTopics = new ArrayList<>();
for (int c = 0; c < numConsumers; c++) {
List<String> topics = new ArrayList<>();
topics.add("shared-topic");
// Put consumer-specific topics first, shared-topic last
// so contains("shared-topic") must scan the entire list
for (int t = 1; t < topicsPerConsumer; t++) {
topics.add("topic-" + c + "-" + t);
}
topics.add("shared-topic"); // last worst case for linear scan
consumerTopics.add(topics);
}
@ -73,10 +75,10 @@ public class Kafka0010RoundRobinAssignorTest {
List<Set<String>> consumerTopicSets = new ArrayList<>();
for (int c = 0; c < numConsumers; c++) {
Set<String> topics = new HashSet<>();
topics.add("shared-topic");
for (int t = 1; t < topicsPerConsumer; t++) {
topics.add("topic-" + c + "-" + t);
}
topics.add("shared-topic");
consumerTopicSets.add(topics);
}