jpountz commented on code in PR #13052: URL: https://github.com/apache/lucene/pull/13052#discussion_r1470784089
########## lucene/core/src/java/org/apache/lucene/index/UpgradeIndexMergePolicy.java: ########## @@ -106,7 +106,11 @@ public MergeSpecification findForcedMerges( // the resulting set contains all segments that are left over // and will be merged to one additional segment: for (final OneMerge om : spec.merges) { - oldSegments.keySet().removeAll(om.segments); + // om.segments.forEach(::remove) is used here instead of oldSegments.keySet().removeAll() + // for performance reasons; om.segments size is always greater than oldSegments size, and Review Comment: This sounds incorrect? `om.segments` is a subset of `oldSegments.keySet()` since the merge policy is only allowed to merge segments that are in `oldSegments.keySet()`. So the problem you are describing only occurs when `oldSegments.size() == om.segments.size()`, ie. the merge policy merges all mergeable segments in one go, which is probably a common case. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org