mikemccand commented on a change in pull request #1590: URL: https://github.com/apache/lucene-solr/pull/1590#discussion_r443538263
########## File path: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java ########## @@ -4286,25 +4287,30 @@ private synchronized void mergeFinish(MergePolicy.OneMerge merge) { @SuppressWarnings("try") private synchronized void closeMergeReaders(MergePolicy.OneMerge merge, boolean suppressExceptions) throws IOException { - final boolean drop = suppressExceptions == false; - try (Closeable finalizer = () -> merge.mergeFinished(suppressExceptions == false)) { - IOUtils.applyToAll(merge.readers, sr -> { - final ReadersAndUpdates rld = getPooledInstance(sr.getOriginalSegmentInfo(), false); - // We still hold a ref so it should not have been removed: - assert rld != null; - if (drop) { - rld.dropChanges(); - } else { - rld.dropMergingUpdates(); - } - rld.release(sr); - release(rld); - if (drop) { - readerPool.drop(rld.info); - } - }); - } finally { - Collections.fill(merge.readers, null); + if (merge.isDone() == false) { Review comment: It is a little weird that we don't then have a `merge.setDone()` or something inside this `if` to make the idempotency really clear. But I understand this code is pre-existingly already hairy so it is not simple to fix that, so progress not perfection! ---------------------------------------------------------------- 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. 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