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.
This commit is contained in:
Gian Merlino 2021-11-16 18:08:35 -08:00 committed by GitHub
parent 7f0bede878
commit d76e646700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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
// Fire segmentRemoved if all replicas have been removed.
if (!segments.contains(segment) && !brokerSegments.contains(segment) && !realtimeSegments.contains(segment)) {
execAndCallback.rhs.segmentRemoved(segment);
}
})
);
}