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 voidflushActiveBytes(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) private voidflushDeletes(DocumentsWriterFlushControl control) protected booleanReturnstrueif thisFlushPolicyflushes onIndexWriterConfig.getMaxBufferedDocs(), otherwisefalse.protected booleanReturnstrueif thisFlushPolicyflushes onIndexWriterConfig.getRAMBufferSizeMB(), otherwisefalse.protected voidmarkLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Marks the most ram consuming activeDocumentsWriterPerThreadflush pendingvoidonChange(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:FlushPolicyCalled for each delete, insert or update. For pure deletes, the givenDocumentsWriterPerThreadmay benull.Note: This method is called synchronized on the given
DocumentsWriterFlushControland it is guaranteed that the calling thread holds the lock on the givenDocumentsWriterPerThread- Specified by:
onChangein classFlushPolicy
-
flushDeletes
-
flushActiveBytes
private void flushActiveBytes(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) -
markLargestWriterPending
protected void markLargestWriterPending(DocumentsWriterFlushControl control, DocumentsWriterPerThread perThread) Marks the most ram consuming activeDocumentsWriterPerThreadflush pending -
flushOnDocCount
protected boolean flushOnDocCount()Returnstrueif thisFlushPolicyflushes onIndexWriterConfig.getMaxBufferedDocs(), otherwisefalse. -
flushOnRAM
protected boolean flushOnRAM()Returnstrueif thisFlushPolicyflushes onIndexWriterConfig.getRAMBufferSizeMB(), otherwisefalse.
-