Class TieredMergePolicy
Merges segments of approximately equal size, subject to an allowed number of segments per tier. This is similar to LogByteSizeMergePolicy, except this merge policy is able to merge non-adjacent segment, and separates how many segments are merged at once (MaxMergeAtOnce) from how many segments are allowed per tier (SegmentsPerTier). This merge policy also does not over-merge (i.e. cascade merges).
For normal merging, this policy first computes a "budget" of how many segments are allowed to be in the index. If the index is over-budget, then the policy sorts segments by decreasing size (pro-rating by percent deletes), and then finds the least-cost merge. Merge cost is measured by a combination of the "skew" of the merge (size of largest segment divided by smallest segment), total merge size and percent deletes reclaimed, so that merges with lower skew, smaller size and those reclaiming more deletes, are favored.
If a merge will produce a segment that's larger than MaxMergedSegmentMB, then the policy will merge fewer segments (down to 1 at once, if that one has deletions) to keep the segment size under budget.
NOTE: This policy freely merges non-adjacent segments; if this is a problem, use LogMergePolicy.
NOTE: This policy always merges by byte size of the segments, always pro-rates by percent deletes, and does not apply any maximum segment size during forceMerge (unlike LogByteSizeMergePolicy).
Implements
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public class TieredMergePolicy : MergePolicy, IDisposable
Constructors
| Improve this Doc View SourceTieredMergePolicy()
Sole constructor, setting all settings to their defaults.
Declaration
public TieredMergePolicy()
Fields
| Improve this Doc View SourceDEFAULT_NO_CFS_RATIO
Default noCFSRatio. If a merge's size is >= 10% of the index, then we disable compound file for it.
Declaration
public static readonly double DEFAULT_NO_CFS_RATIO
Field Value
Type | Description |
---|---|
System.Double |
See Also
Properties
| Improve this Doc View SourceFloorSegmentMB
Segments smaller than this are "rounded up" to this size, ie treated as equal (floor) size for merge selection. this is to prevent frequent flushing of tiny segments from allowing a long tail in the index. Default is 2 MB.
Declaration
public virtual double FloorSegmentMB { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ForceMergeDeletesPctAllowed
When forceMergeDeletes is called, we only merge away a segment if its delete percentage is over this threshold. Default is 10%.
Declaration
public virtual double ForceMergeDeletesPctAllowed { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
MaxMergeAtOnce
Gets or sets maximum number of segments to be merged at a time during "normal" merging. For explicit merging (eg, ForceMerge(Int32) or ForceMergeDeletes() was called), see MaxMergeAtOnceExplicit. Default is 10.
Declaration
public virtual int MaxMergeAtOnce { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxMergeAtOnceExplicit
Gets or sets maximum number of segments to be merged at a time, during ForceMerge(Int32) or ForceMergeDeletes(). Default is 30.
Declaration
public virtual int MaxMergeAtOnceExplicit { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxMergedSegmentMB
Gets or sets maximum sized segment to produce during normal merging. This setting is approximate: the estimate of the merged segment size is made by summing sizes of to-be-merged segments (compensating for percent deleted docs). Default is 5 GB.
Declaration
public virtual double MaxMergedSegmentMB { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
ReclaimDeletesWeight
Controls how aggressively merges that reclaim more deletions are favored. Higher values will more aggressively target merges that reclaim deletions, but be careful not to go so high that way too much merging takes place; a value of 3.0 is probably nearly too high. A value of 0.0 means deletions don't impact merge selection.
Declaration
public virtual double ReclaimDeletesWeight { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
SegmentsPerTier
Gets or sets the allowed number of segments per tier. Smaller values mean more merging but fewer segments.
NOTE: this value should be >= the MaxMergeAtOnce otherwise you'll force too much merging to occur.
Default is 10.0.
Declaration
public virtual double SegmentsPerTier { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
| Improve this Doc View SourceDispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
| Improve this Doc View SourceFindForcedDeletesMerges(SegmentInfos)
Declaration
public override MergePolicy.MergeSpecification FindForcedDeletesMerges(SegmentInfos infos)
Parameters
Type | Name | Description |
---|---|---|
SegmentInfos | infos |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
| Improve this Doc View SourceFindForcedMerges(SegmentInfos, Int32, IDictionary<SegmentCommitInfo, Nullable<Boolean>>)
Declaration
public override MergePolicy.MergeSpecification FindForcedMerges(SegmentInfos infos, int maxSegmentCount, IDictionary<SegmentCommitInfo, bool?> segmentsToMerge)
Parameters
Type | Name | Description |
---|---|---|
SegmentInfos | infos | |
System.Int32 | maxSegmentCount | |
System.Collections.Generic.IDictionary<SegmentCommitInfo, System.Nullable<System.Boolean>> | segmentsToMerge |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
FindMerges(MergeTrigger, SegmentInfos)
Declaration
public override MergePolicy.MergeSpecification FindMerges(MergeTrigger mergeTrigger, SegmentInfos infos)
Parameters
Type | Name | Description |
---|---|---|
MergeTrigger | mergeTrigger | |
SegmentInfos | infos |
Returns
Type | Description |
---|---|
MergePolicy.MergeSpecification |
Overrides
| Improve this Doc View SourceScore(IList<SegmentCommitInfo>, Boolean, Int64)
Expert: scores one merge; subclasses can override.
Declaration
protected virtual TieredMergePolicy.MergeScore Score(IList<SegmentCommitInfo> candidate, bool hitTooLarge, long mergingBytes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<SegmentCommitInfo> | candidate | |
System.Boolean | hitTooLarge | |
System.Int64 | mergingBytes |
Returns
Type | Description |
---|---|
TieredMergePolicy.MergeScore |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |