Class ComposingReindexingRuleProvider
- All Implemented Interfaces:
ReindexingRuleProvider
ReindexingRuleProviders with first-wins semantics.
This provider delegates rule queries to a list of child providers in order. For each rule type, it returns the result from the first provider that has non-empty rules of that type.
First-Wins Strategy: Provider order determines precedence. If provider A returns rules of a given type, those rules are used and subsequent providers are not consulted for that type. This applies to all rule types, regardless of whether they are additive or non-additive.
Readiness: The composing provider is considered ready only when ALL child providers are ready. This ensures consistent behavior during startup.
Example Usage:
{
"type": "composing",
"providers": [
{
"type": "inline",
"partitioningRules": [
{
"id": "recent-data-partitioning",
"olderThan": "P7D",
"segmentGranularity": "HOUR",
"partitionsSpec": { "type": "dynamic", "maxRowsPerSegment": 5000000 }
}
]
}
]
}
In this example:
- Composing rule with a single provider to simply show the inline definition.
- Once multiple provider types exist, this will allow operators to chain them as needed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing data schema rule that applies to the given interval.Returns ALL reindexing data schema rules.Returns ALL reindexing deletion rules.getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns all reindexing deletion rules that apply to the given interval.getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing index spec rule that applies to the given interval.Returns ALL reindexing index spec rules.getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing partitioning rule that applies to the given interval.Returns ALL reindexing partitioning rules.getType()Returns the type identifier for this provider implementation.inthashCode()booleanisReady()Returns true if this provider is ready to supply rules.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.server.compaction.ReindexingRuleProvider
streamAllRules
-
Field Details
-
TYPE
- See Also:
-
-
Constructor Details
-
ComposingReindexingRuleProvider
-
-
Method Details
-
getProviders
-
getType
Description copied from interface:ReindexingRuleProviderReturns the type identifier for this provider implementation.This value is used in JSON serialization to identify which provider implementation to use when deserializing.
- Specified by:
getTypein interfaceReindexingRuleProvider- Returns:
- the type identifier (e.g., "inline", "external")
-
isReady
public boolean isReady()Description copied from interface:ReindexingRuleProviderReturns true if this provider is ready to supply rules.Providers that depend on external state (HTTP services, databases) should return false until they have successfully initialized and loaded their rules. Reindexing supervisors should check this before generating tasks to avoid creating tasks with incomplete rule sets.
The default implementation returns true, which is appropriate for providers that have their rules available immediately (such as inline providers with static configuration).
- Specified by:
isReadyin interfaceReindexingRuleProvider- Returns:
- true if the provider is ready to supply rules, false otherwise
-
getDeletionRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing deletion rules.- Specified by:
getDeletionRulesin interfaceReindexingRuleProvider
-
getDeletionRules
public List<ReindexingDeletionRule> getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns all reindexing deletion rules that apply to the given interval.Handling partial overlaps is the responsibility of the provider implementation and should be clearly documented.
- Specified by:
getDeletionRulesin interfaceReindexingRuleProvider- Parameters:
interval- The interval to check applicability against.referenceTime- The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.- Returns:
- The list of
ReindexingDeletionRulerules that apply to the given interval.
-
getDataSchemaRule
@Nullable public ReindexingDataSchemaRule getDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns the matched reindexing data schema rule that applies to the given interval.Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.
- Specified by:
getDataSchemaRulein interfaceReindexingRuleProvider- Parameters:
interval- The interval to check applicability against.referenceTime- The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.- Returns:
ReindexingDataSchemaRulerule that applies to the given interval.
-
getDataSchemaRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing data schema rules.- Specified by:
getDataSchemaRulesin interfaceReindexingRuleProvider
-
getPartitioningRule
@Nullable public ReindexingPartitioningRule getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns the matched reindexing partitioning rule that applies to the given interval.Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.
- Specified by:
getPartitioningRulein interfaceReindexingRuleProvider- Parameters:
interval- The interval to check applicability against.referenceTime- The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.- Returns:
ReindexingPartitioningRulerule that applies to the given interval.
-
getPartitioningRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing partitioning rules.- Specified by:
getPartitioningRulesin interfaceReindexingRuleProvider
-
getIndexSpecRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing index spec rules.- Specified by:
getIndexSpecRulesin interfaceReindexingRuleProvider
-
getIndexSpecRule
@Nullable public ReindexingIndexSpecRule getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns the matched reindexing index spec rule that applies to the given interval.Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.
- Specified by:
getIndexSpecRulein interfaceReindexingRuleProvider- Parameters:
interval- The interval to check applicability against.referenceTime- The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
-
equals
-
hashCode
public int hashCode() -
toString
-