Skip to content

Apache Lucene open-source search software

reduce noise to IW's infoStream

Michael McCandless305a48f3dabf
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 c79d693342c..552c7bf25c1 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java
@@ -302,12 +302,6 @@ final class DocumentsWriter implements Closeable, Accountable {
}
boolean anyChanges() {
- if (infoStream.isEnabled("DW")) {
- infoStream.message("DW", "anyChanges? numDocsInRam=" + numDocsInRAM.get()
- + " deletes=" + anyDeletions() + " hasTickets:"
- + ticketQueue.hasTickets() + " pendingChangesInFullFlush: "
- + pendingChangesInCurrentFullFlush);
- }
/*
* changes are either in a DWPT or in the deleteQueue.
* yet if we currently flush deletes and / or dwpt there
@@ -315,7 +309,16 @@ final class DocumentsWriter implements Closeable, Accountable {
* before they are published to the IW. ie we need to check if the
* ticket queue has any tickets.
*/
- return numDocsInRAM.get() != 0 || anyDeletions() || ticketQueue.hasTickets() || pendingChangesInCurrentFullFlush;
+ boolean anyChanges = numDocsInRAM.get() != 0 || anyDeletions() || ticketQueue.hasTickets() || pendingChangesInCurrentFullFlush;
+ if (infoStream.isEnabled("DW")) {
+ if (anyChanges) {
+ infoStream.message("DW", "anyChanges? numDocsInRam=" + numDocsInRAM.get()
+ + " deletes=" + anyDeletions() + " hasTickets:"
+ + ticketQueue.hasTickets() + " pendingChangesInFullFlush: "
+ + pendingChangesInCurrentFullFlush);
+ }
+ }
+ return anyChanges;
}
public int getBufferedDeleteTermsSize() {
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index be9a8f8fd3a..0faadaa6367 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -4420,10 +4420,13 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
synchronized boolean nrtIsCurrent(SegmentInfos infos) {
//System.out.println("IW.nrtIsCurrent " + (infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedDeletesStream.any()));
ensureOpen();
+ boolean isCurrent = infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedUpdatesStream.any();
if (infoStream.isEnabled("IW")) {
- infoStream.message("IW", "nrtIsCurrent: infoVersion matches: " + (infos.version == segmentInfos.version) + "; DW changes: " + docWriter.anyChanges() + "; BD changes: "+ bufferedUpdatesStream.any());
+ if (isCurrent == false) {
+ infoStream.message("IW", "nrtIsCurrent: infoVersion matches: " + (infos.version == segmentInfos.version) + "; DW changes: " + docWriter.anyChanges() + "; BD changes: "+ bufferedUpdatesStream.any());
+ }
}
- return infos.version == segmentInfos.version && !docWriter.anyChanges() && !bufferedUpdatesStream.any();
+ return isCurrent;
}
synchronized boolean isClosed() {