diff --git a/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java b/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java index 37843d8eae7..3a5c790631e 100644 --- a/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java +++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java @@ -167,12 +167,14 @@ public final class DocumentsWriterFlushControl { */ public synchronized void setFlushPending(ThreadState perThread) { assert !perThread.flushPending; - assert perThread.perThread.getNumDocsInRAM() > 0; - perThread.flushPending = true; // write access synced - final long bytes = perThread.perThreadBytes; - flushBytes += bytes; - activeBytes -= bytes; - numPending++; // write access synced + if (perThread.perThread.getNumDocsInRAM() > 0) { + perThread.flushPending = true; // write access synced + final long bytes = perThread.perThreadBytes; + flushBytes += bytes; + activeBytes -= bytes; + numPending++; // write access synced + } // don't assert on numDocs since we could hit an abort excp. while selecting that dwpt for flushing + } synchronized void doOnAbort(ThreadState state) { diff --git a/lucene/src/java/org/apache/lucene/index/FlushPolicy.java b/lucene/src/java/org/apache/lucene/index/FlushPolicy.java index b4b375e31e9..0997eca4ebe 100644 --- a/lucene/src/java/org/apache/lucene/index/FlushPolicy.java +++ b/lucene/src/java/org/apache/lucene/index/FlushPolicy.java @@ -132,7 +132,6 @@ public abstract class FlushPolicy { } } } - assert maxRamUsingThreadState.perThread.getNumDocsInRAM() > 0; assert writer.get().message( "set largest ram consuming thread pending on lower watermark"); return maxRamUsingThreadState;