From d76e6467004094aef7279903e64532515fde1e95 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Tue, 16 Nov 2021 18:08:35 -0800 Subject: [PATCH] Fix TestServerInventoryView behavioral discrepancy. (#11932) Unlike a real one, TestServerInventoryView would call segmentRemoved any time _any_ segment was removed. It should only be called when _all_ segments have been removed. --- .../druid/sql/calcite/util/TestServerInventoryView.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/TestServerInventoryView.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/TestServerInventoryView.java index 170d205f449..d74b36739cf 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/TestServerInventoryView.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/util/TestServerInventoryView.java @@ -187,8 +187,11 @@ public class TestServerInventoryView implements TimelineServerView timelineCallbackExecs.forEach( execAndCallback -> execAndCallback.lhs.execute(() -> { execAndCallback.rhs.serverSegmentRemoved(whichServer, segment); - // assume that all replicas have been removed and fire this one too - execAndCallback.rhs.segmentRemoved(segment); + + // Fire segmentRemoved if all replicas have been removed. + if (!segments.contains(segment) && !brokerSegments.contains(segment) && !realtimeSegments.contains(segment)) { + execAndCallback.rhs.segmentRemoved(segment); + } }) ); }