Skip to content

Commit

Permalink
Fix TestServerInventoryView behavioral discrepancy. (#11932)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gianm authored Nov 17, 2021
1 parent 7f0bede commit d76e646
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ public void removeSegment(DataSegment segment, ServerType serverType)
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);
}
})
);
}
Expand Down

0 comments on commit d76e646

Please sign in to comment.