Package org.apache.lucene.index
Class FlushByRamOrCountsPolicy
- 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.onDelete(DocumentsWriterFlushControl, DocumentsWriterPerThread)
- applies pending delete operations based on the global number of buffered delete terms if the consumed memory is greater thanIndexWriterConfig.getRAMBufferSizeMB()
.onInsert(DocumentsWriterFlushControl, DocumentsWriterPerThread)
- flushes either on the number of documents perDocumentsWriterPerThread
(DocumentsWriterPerThread.getNumDocsInRAM()
) or on the global active memory consumption in the current indexing session iffIndexWriterConfig.getMaxBufferedDocs()
orIndexWriterConfig.getRAMBufferSizeMB()
is enabled respectivelyFlushPolicy.onUpdate(DocumentsWriterFlushControl, DocumentsWriterPerThread)
- callsonInsert(DocumentsWriterFlushControl, DocumentsWriterPerThread)
andonDelete(DocumentsWriterFlushControl, DocumentsWriterPerThread)
in order
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 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
onDelete(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Called for each delete term.void
onInsert(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Called for each document addition on the givenDocumentsWriterPerThread
sDocumentsWriterPerThread
.-
Methods inherited from class org.apache.lucene.index.FlushPolicy
findLargestNonPendingWriter, init, onUpdate
-
-
-
-
Method Detail
-
onDelete
public void onDelete(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Description copied from class:FlushPolicy
Called for each delete term. If this is a delete triggered due to an update the givenDocumentsWriterPerThread
is non-null.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:
onDelete
in classFlushPolicy
-
onInsert
public void onInsert(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread)
Description copied from class:FlushPolicy
Called for each document addition on the givenDocumentsWriterPerThread
sDocumentsWriterPerThread
.Note: This method is synchronized by the given
DocumentsWriterFlushControl
and it is guaranteed that the calling thread holds the lock on the givenDocumentsWriterPerThread
- Specified by:
onInsert
in classFlushPolicy
-
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
.
-
-