java.lang.Object
org.apache.lucene.index.DocumentsWriterStallControl
Controls the health status of a
DocumentsWriter
sessions. This class used to block
incoming indexing threads if flushing significantly slower than indexing to ensure the DocumentsWriter
s healthiness. If flushing is significantly slower than indexing the net memory
used within an IndexWriter
session can increase very quickly and easily exceed the JVM's
available memory.
To prevent OOM Errors and ensure IndexWriter's stability this class blocks incoming threads
from indexing once 2 x number of available DocumentsWriterPerThread
s in DocumentsWriterPerThreadPool
is exceeded. Once flushing catches up and the number of flushing
DWPT is equal or lower than the number of active DocumentsWriterPerThread
s threads are
released and can continue indexing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
private void
(package private) int
(package private) boolean
private void
(package private) boolean
(package private) boolean
(package private) void
updateStalled
(boolean stalled) Update the stalled flag status.(package private) void
Blocks if documents writing is currently in a stalled state.(package private) boolean
-
Field Details
-
stalled
private volatile boolean stalled -
numWaiting
private int numWaiting -
wasStalled
private boolean wasStalled -
waiting
-
-
Constructor Details
-
DocumentsWriterStallControl
DocumentsWriterStallControl()
-
-
Method Details
-
updateStalled
void updateStalled(boolean stalled) Update the stalled flag status. This method will set the stalled flag totrue
iff the number of flushingDocumentsWriterPerThread
is greater than the number of activeDocumentsWriterPerThread
. Otherwise it will reset theDocumentsWriterStallControl
to healthy and release all threads waiting onwaitIfStalled()
-
waitIfStalled
void waitIfStalled()Blocks if documents writing is currently in a stalled state. -
anyStalledThreads
boolean anyStalledThreads() -
incWaiters
private void incWaiters() -
decrWaiters
private void decrWaiters() -
hasBlocked
boolean hasBlocked() -
getNumWaiting
int getNumWaiting() -
isHealthy
boolean isHealthy() -
isThreadQueued
-
wasStalled
boolean wasStalled()
-