Class MostFragmentedIntervalFirstPolicy
java.lang.Object
org.apache.druid.server.compaction.BaseCandidateSearchPolicy
org.apache.druid.server.compaction.MostFragmentedIntervalFirstPolicy
- All Implemented Interfaces:
CompactionCandidateSearchPolicy
Experimental
CompactionCandidateSearchPolicy which prioritizes compaction
of intervals with the largest number of small uncompacted segments.
This policy favors cluster stability (by prioritizing reduction of segment
count) over performance of queries on newer intervals. For the latter, use
NewestSegmentFirstPolicy.
-
Constructor Summary
ConstructorsConstructorDescriptionMostFragmentedIntervalFirstPolicy(Integer minUncompactedCount, HumanReadableBytes minUncompactedBytes, HumanReadableBytes maxAverageUncompactedBytesPerSegment, Integer minUncompactedBytesPercentForFullCompaction, Integer minUncompactedRowsPercentForFullCompaction, String priorityDatasource) -
Method Summary
Modifier and TypeMethodDescriptioncheckEligibilityForCompaction(CompactionCandidate candidate, CompactionTaskStatus latestTaskStatus) Checks if the givenCompactionCandidateis eligible for compaction in the current iteration.booleanMaximum average size of uncompacted segments in an interval eligible for compaction.Minimum total bytes of uncompacted segments that must be present in an interval to make it eligible for compaction.intMinimum number of uncompacted segments that must be present in an interval to make it eligible for compaction.protected Comparator<CompactionCandidate>Compares between two compaction candidates.inthashCode()intThreshold percentage of uncompacted bytes to total bytes below which minor compaction is eligible instead of full compaction.intThreshold percentage of uncompacted rows to total rows below which minor compaction is eligible instead of full compaction.toString()Methods inherited from class org.apache.druid.server.compaction.BaseCandidateSearchPolicy
compareCandidates, getPriorityDatasource
-
Constructor Details
-
MostFragmentedIntervalFirstPolicy
public MostFragmentedIntervalFirstPolicy(@Nullable Integer minUncompactedCount, @Nullable HumanReadableBytes minUncompactedBytes, @Nullable HumanReadableBytes maxAverageUncompactedBytesPerSegment, @Nullable Integer minUncompactedBytesPercentForFullCompaction, @Nullable Integer minUncompactedRowsPercentForFullCompaction, @Nullable String priorityDatasource)
-
-
Method Details
-
getMinUncompactedCount
public int getMinUncompactedCount()Minimum number of uncompacted segments that must be present in an interval to make it eligible for compaction. -
getMinUncompactedBytes
Minimum total bytes of uncompacted segments that must be present in an interval to make it eligible for compaction. Default value isSIZE_10_MB. -
getMaxAverageUncompactedBytesPerSegment
Maximum average size of uncompacted segments in an interval eligible for compaction. Default value isSIZE_2_GB. -
minUncompactedBytesPercentForFullCompaction
public int minUncompactedBytesPercentForFullCompaction()Threshold percentage of uncompacted bytes to total bytes below which minor compaction is eligible instead of full compaction. Default value is 0. -
minUncompactedRowsPercentForFullCompaction
public int minUncompactedRowsPercentForFullCompaction()Threshold percentage of uncompacted rows to total rows below which minor compaction is eligible instead of full compaction. Default value is 0. -
getSegmentComparator
Description copied from class:BaseCandidateSearchPolicyCompares between two compaction candidates. Used to determine the order in which segments and intervals should be picked for compaction.- Specified by:
getSegmentComparatorin classBaseCandidateSearchPolicy
-
equals
- Overrides:
equalsin classBaseCandidateSearchPolicy
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseCandidateSearchPolicy
-
toString
-
checkEligibilityForCompaction
public Eligibility checkEligibilityForCompaction(CompactionCandidate candidate, CompactionTaskStatus latestTaskStatus) Description copied from interface:CompactionCandidateSearchPolicyChecks if the givenCompactionCandidateis eligible for compaction in the current iteration. A policy may implement this method to skip compacting intervals or segments that do not fulfil some required criteria.- Specified by:
checkEligibilityForCompactionin interfaceCompactionCandidateSearchPolicy- Overrides:
checkEligibilityForCompactionin classBaseCandidateSearchPolicy- Returns:
Eligibility.FULLonly if eligible.
-