mirror of https://github.com/apache/lucene.git
LUCENE-9504 Remove extra lock in DocumentsWriterDeleteQueue (#1826)
This commit is contained in:
parent
b988d557d7
commit
4c5c8c4ead
|
@ -509,27 +509,18 @@ final class DocumentsWriterDeleteQueue implements Accountable, Closeable {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean forceApplyGlobalSlice() {
|
||||
globalBufferLock.lock();
|
||||
final Node<?> currentTail = tail;
|
||||
public int getBufferedUpdatesTermsSize() {
|
||||
final ReentrantLock lock = globalBufferLock; // Trusted final
|
||||
lock.lock();
|
||||
try {
|
||||
final Node<?> currentTail = tail;
|
||||
if (globalSlice.sliceTail != currentTail) {
|
||||
globalSlice.sliceTail = currentTail;
|
||||
globalSlice.apply(globalBufferedUpdates, BufferedUpdates.MAX_INT);
|
||||
}
|
||||
return globalBufferedUpdates.any();
|
||||
} finally {
|
||||
globalBufferLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public int getBufferedUpdatesTermsSize() {
|
||||
globalBufferLock.lock();
|
||||
try {
|
||||
forceApplyGlobalSlice();
|
||||
return globalBufferedUpdates.deleteTerms.size();
|
||||
} finally {
|
||||
globalBufferLock.unlock();
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue