Skip to content

Apache Lucene open-source search software

Short circuit queued flush check when flush on update is disabled (#13115)

Prabhat8a73cdef8ca7
diff --git a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
index ec6ced68002..d85df1cf8cd 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
@@ -384,7 +384,7 @@ final class DocumentsWriter implements Closeable, Accountable {
ensureOpen();
boolean hasEvents = false;
while (flushControl.anyStalledThreads()
- || (flushControl.numQueuedFlushes() > 0 && config.checkPendingFlushOnUpdate)) {
+ || (config.checkPendingFlushOnUpdate && flushControl.numQueuedFlushes() > 0)) {
// Help out flushing any queued DWPTs so we can un-stall:
// Try pickup pending threads here if possible
// no need to loop over the next pending flushes... doFlush will take care of this