Skip to content

Commit eacb70f

Browse files
authored
Adding assertion and message to debug issue #102261 (#102733) (#102764)
1 parent cc31ce9 commit eacb70f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/src/main/java/org/elasticsearch/ingest/IngestStats.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.List;
2929
import java.util.Map;
3030
import java.util.concurrent.TimeUnit;
31+
import java.util.stream.Collectors;
3132

3233
public record IngestStats(Stats totalStats, List<PipelineStat> pipelineStats, Map<String, List<ProcessorStat>> processorStats)
3334
implements
@@ -266,6 +267,12 @@ public record ProcessorStat(String name, String type, Stats stats) {
266267
// both lists using a common index iterator.
267268
private static List<ProcessorStat> merge(List<ProcessorStat> first, List<ProcessorStat> second) {
268269
var merged = new ArrayList<ProcessorStat>();
270+
assert first.size() == second.size()
271+
: "stats size mismatch ["
272+
+ first.stream().map(ps -> ps.name + ":" + ps.type).collect(Collectors.joining(","))
273+
+ "] ["
274+
+ second.stream().map(ps -> ps.name + ":" + ps.type).collect(Collectors.joining(","))
275+
+ "]";
269276
for (var i = 0; i < first.size(); i++) {
270277
merged.add(new ProcessorStat(first.get(i).name, first.get(i).type, Stats.merge(first.get(i).stats, second.get(i).stats)));
271278
}

0 commit comments

Comments
 (0)