- java.lang.Object
-
- org.apache.lucene.index.FlushPolicy
-
- org.apache.lucene.index.FlushByRamOrCountsPolicy
-
class FlushByRamOrCountsPolicy extends FlushPolicy
DefaultFlushPolicy
implementation that flushes new segments based on RAM used and document count depending on the IndexWriter'sIndexWriterConfig
. It also applies pending deletes based on the number of buffered delete terms.All
IndexWriterConfig
settings are used to markDocumentsWriterPerThread
as flush pending during indexing with respect to their live updates.If
IndexWriterConfig.setRAMBufferSizeMB(double)
is enabled, the largest ram consumingDocumentsWriterPerThread
will be marked as pending iff the global active RAM consumption is>=
the configured max RAM buffer.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.index.FlushPolicy
indexWriterConfig, infoStream
-
-
Constructor Summary
Constructors Constructor Description FlushByRamOrCountsPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
flushActiveBytes(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
private void
flushDeletes(DocumentsWriterFlushControl control)
protected boolean
flushOnDocCount()
Returnstrue
if thisFlushPolicy
flushes onIndexWriterConfig.getMaxBufferedDocs()
, otherwisefalse
.protected boolean
flushOnRAM()
Returnstrue
if thisFlushPolicy
flushes onIndexWriterConfig.getRAMBufferSizeMB()
, otherwisefalse
.protected void
markLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Marks the most ram consuming activeDocumentsWriterPerThread
flush pendingvoid
onChange(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Called for each delete, insert or update.-
Methods inherited from class org.apache.lucene.index.FlushPolicy
findLargestNonPendingWriter, init
-
-
-
-
Method Detail
-
onChange
public void onChange(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Description copied from class:FlushPolicy
Called for each delete, insert or update. For pure deletes, the givenDocumentsWriterPerThread
may benull
.Note: This method is called synchronized on the given
DocumentsWriterFlushControl
and it is guaranteed that the calling thread holds the lock on the givenDocumentsWriterPerThread
- Specified by:
onChange
in classFlushPolicy
-
flushDeletes
private void flushDeletes(DocumentsWriterFlushControl control)
-
flushActiveBytes
private void flushActiveBytes(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
-
markLargestWriterPending
protected void markLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Marks the most ram consuming activeDocumentsWriterPerThread
flush pending
-
flushOnDocCount
protected boolean flushOnDocCount()
Returnstrue
if thisFlushPolicy
flushes onIndexWriterConfig.getMaxBufferedDocs()
, otherwisefalse
.
-
flushOnRAM
protected boolean flushOnRAM()
Returnstrue
if thisFlushPolicy
flushes onIndexWriterConfig.getRAMBufferSizeMB()
, otherwisefalse
.
-
-