Class ConcurrentMergeScheduler
A MergeScheduler that runs each merge using a separate thread.
Specify the max number of threads that may run at once, and the maximum number of simultaneous merges with SetMaxMergesAndThreads(Int32, Int32).
If the number of merges exceeds the max number of threads then the largest merges are paused until one of the smaller merges completes.
If more than MaxMergeCount merges are requested then this class will forcefully throttle the incoming threads by pausing until one more more merges complete.
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public class ConcurrentMergeScheduler : MergeScheduler, IConcurrentMergeScheduler, IMergeScheduler, IDisposable
Constructors
Name | Description |
---|---|
ConcurrentMergeScheduler() | Sole constructor, with all settings set to default values. |
Fields
Name | Description |
---|---|
compareByMergeDocCount | Sorts ConcurrentMergeScheduler.MergeThreads; larger merges come first. |
DEFAULT_MAX_MERGE_COUNT | Default MaxMergeCount. |
DEFAULT_MAX_THREAD_COUNT | Default MaxThreadCount. We default to 1: tests on spinning-magnet drives showed slower indexing performance if more than one merge thread runs at once (though on an SSD it was faster) |
m_dir | Directory that holds the index. |
m_mergeThreadCount | How many ConcurrentMergeScheduler.MergeThreads have kicked off (this is use to name them). |
m_mergeThreads | List of currently active ConcurrentMergeScheduler.MergeThreads. |
m_writer | IndexWriter that owns this instance. |
Properties
Name | Description |
---|---|
IsVerbose | Returns
|
MaxMergeCount | |
MaxThreadCount | Returns Lucene.Net.Index.ConcurrentMergeScheduler.maxThreadCount. |
MergeThreadCount | Returns the number of merge threads that are alive. Note that this number is <= m_mergeThreads size. |
MergeThreadPriority | Return the priority that merge threads run at. By default the priority is 1 plus the priority of (ie, slightly higher priority than) the first thread that calls merge. |
Methods
Name | Description |
---|---|
ClearSuppressExceptions() | Used for testing |
Clone() | |
Dispose(Boolean) | |
DoMerge(MergePolicy.OneMerge) | Does the actual merge, by calling Merge(MergePolicy.OneMerge) |
GetMergeThread(IndexWriter, MergePolicy.OneMerge) | Create and return a new ConcurrentMergeScheduler.MergeThread |
HandleMergeException(Exception) | Called when an exception is hit in a background merge thread |
Merge(IndexWriter, MergeTrigger, Boolean) | |
Message(String) | Outputs the given message - this method assumes IsVerbose was
called and returned |
SetMaxMergesAndThreads(Int32, Int32) | Sets the maximum number of merge threads and simultaneous merges allowed. |
SetMergeThreadPriority(Int32) | Set the base priority that merge threads run at.
Note that CMS may increase priority of some merge
threads beyond this base priority. It's best not to
set this any higher than
|
SetSuppressExceptions() | Used for testing |
Sync() | Wait for any running merge threads to finish. This call is not interruptible as used by Dispose(Boolean). |
ToString() | |
UpdateMergeThreads() | Called whenever the running merges have changed, to pause & unpause threads. This method sorts the merge threads by their merge size in descending order and then pauses/unpauses threads from first to last -- that way, smaller merges are guaranteed to run before larger ones. |