diff --git a/lucene/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java b/lucene/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java index 33484deec62..69d11e58825 100644 --- a/lucene/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java +++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriterDeleteQueue.java @@ -72,6 +72,8 @@ final class DocumentsWriterDeleteQueue { private final BufferedDeletes globalBufferedDeletes; /* only acquired to update the global deletes */ private final ReentrantLock globalBufferLock = new ReentrantLock(); + + long generation; DocumentsWriterDeleteQueue() { this(new BufferedDeletes(false)); @@ -379,4 +381,11 @@ final class DocumentsWriterDeleteQueue { public long bytesUsed() { return globalBufferedDeletes.bytesUsed.get(); } + + @Override + public String toString() { + return "DWDQ: [ generation: " + generation + " ]"; + } + + } diff --git a/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java b/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java index 7b968a8b4b4..8ed235ceb55 100644 --- a/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java +++ b/lucene/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java @@ -303,7 +303,9 @@ public final class DocumentsWriterFlushControl { flushingQueue = documentsWriter.deleteQueue; // Set a new delete queue - all subsequent DWPT will use this queue until // we do another full flush - documentsWriter.deleteQueue = new DocumentsWriterDeleteQueue(new BufferedDeletes(false)); + DocumentsWriterDeleteQueue newQueue = new DocumentsWriterDeleteQueue(); + newQueue.generation = flushingQueue.generation + 1; + documentsWriter.deleteQueue = newQueue; } final Iterator allActiveThreads = perThreadPool .getActivePerThreadsIterator(); @@ -315,7 +317,14 @@ public final class DocumentsWriterFlushControl { if (!next.isActive()) { continue; } - assert next.perThread.deleteQueue == flushingQueue || next.perThread.deleteQueue == documentsWriter.deleteQueue; + assert next.perThread.deleteQueue == flushingQueue + || next.perThread.deleteQueue == documentsWriter.deleteQueue : " flushingQueue: " + + flushingQueue + + " currentqueue: " + + documentsWriter.deleteQueue + + " perThread queue: " + + next.perThread.deleteQueue + + " numDocsInRam: " + next.perThread.getNumDocsInRAM(); if (next.perThread.deleteQueue != flushingQueue) { // this one is already a new DWPT continue;