sequence numbers: remove dead variable, improve comments

This commit is contained in:
Mike McCandless 2016-05-26 15:41:39 -04:00
parent 817c7f069a
commit 34673adab2
2 changed files with 4 additions and 5 deletions

View File

@ -77,17 +77,17 @@ final class DocumentsWriterDeleteQueue implements Accountable {
private final DeleteSlice globalSlice;
private final BufferedUpdates globalBufferedUpdates;
private long gen;
// only acquired to update the global deletes, pkg-private for access by tests:
final ReentrantLock globalBufferLock = new ReentrantLock();
final long generation;
/** Generates the sequence number that IW returns to callers changing the index, showing the effective serialization of all operations. */
final AtomicLong seqNo;
DocumentsWriterDeleteQueue() {
// seqNo must start at 1 because some APIs negate this to encode a boolean
// seqNo must start at 1 because some APIs negate this to also return a boolean
this(0, 1);
}

View File

@ -481,11 +481,10 @@ final class DocumentsWriterFlushControl implements Accountable {
// we do another full flush
//System.out.println("DWFC: fullFLush old seqNo=" + documentsWriter.deleteQueue.seqNo.get() + " activeThreadCount=" + perThreadPool.getActiveThreadStateCount());
// jump over any possible in flight ops:
seqNo = documentsWriter.deleteQueue.seqNo.get() + perThreadPool.getActiveThreadStateCount();
// Insert a gap in seqNo of current active thread count, in the worst case those threads now have one operation in flight. It's fine
// if we have some sequence numbers that were never assigned:
seqNo = documentsWriter.deleteQueue.seqNo.get() + perThreadPool.getActiveThreadStateCount();
DocumentsWriterDeleteQueue newQueue = new DocumentsWriterDeleteQueue(flushingQueue.generation+1, seqNo+1);
documentsWriter.deleteQueue = newQueue;