java.lang.Object
org.apache.lucene.index.FlushPolicy
org.apache.lucene.index.FlushByRamOrCountsPolicy
Default
FlushPolicy
implementation that flushes new segments based on RAM used and
document count depending on the IndexWriter's IndexWriterConfig
. It also applies pending
deletes based on the number of buffered delete terms.
All IndexWriterConfig
settings are used to mark DocumentsWriterPerThread
as
flush pending during indexing with respect to their live updates.
If IndexWriterConfig.setRAMBufferSizeMB(double)
is enabled, the largest ram consuming
DocumentsWriterPerThread
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 -
Method Summary
Modifier and TypeMethodDescriptionprivate void
flushActiveBytes
(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) private void
flushDeletes
(DocumentsWriterFlushControl control) protected boolean
Returnstrue
if thisFlushPolicy
flushes onIndexWriterConfig.getMaxBufferedDocs()
, otherwisefalse
.protected boolean
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
-
Constructor Details
-
FlushByRamOrCountsPolicy
FlushByRamOrCountsPolicy()
-
-
Method Details
-
onChange
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
-
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
.
-