Class ComposingReindexingRuleProvider

java.lang.Object
org.apache.druid.server.compaction.ComposingReindexingRuleProvider
All Implemented Interfaces:
ReindexingRuleProvider

public class ComposingReindexingRuleProvider extends Object implements ReindexingRuleProvider
A meta-provider that composes multiple 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 Details

  • Constructor Details

  • Method Details

    • getProviders

      public List<ReindexingRuleProvider> getProviders()
    • getType

      public String getType()
      Description copied from interface: ReindexingRuleProvider
      Returns 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:
      getType in interface ReindexingRuleProvider
      Returns:
      the type identifier (e.g., "inline", "external")
    • isReady

      public boolean isReady()
      Description copied from interface: ReindexingRuleProvider
      Returns 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:
      isReady in interface ReindexingRuleProvider
      Returns:
      true if the provider is ready to supply rules, false otherwise
    • getDeletionRules

      public List<ReindexingDeletionRule> getDeletionRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing deletion rules.
      Specified by:
      getDeletionRules in interface ReindexingRuleProvider
    • getDeletionRules

      public List<ReindexingDeletionRule> getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns 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:
      getDeletionRules in interface ReindexingRuleProvider
      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 ReindexingDeletionRule rules 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: ReindexingRuleProvider
      Returns 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:
      getDataSchemaRule in interface ReindexingRuleProvider
      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:
      ReindexingDataSchemaRule rule that applies to the given interval.
    • getDataSchemaRules

      public List<ReindexingDataSchemaRule> getDataSchemaRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing data schema rules.
      Specified by:
      getDataSchemaRules in interface ReindexingRuleProvider
    • getPartitioningRule

      @Nullable public ReindexingPartitioningRule getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns 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:
      getPartitioningRule in interface ReindexingRuleProvider
      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:
      ReindexingPartitioningRule rule that applies to the given interval.
    • getPartitioningRules

      public List<ReindexingPartitioningRule> getPartitioningRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing partitioning rules.
      Specified by:
      getPartitioningRules in interface ReindexingRuleProvider
    • getIndexSpecRules

      public List<ReindexingIndexSpecRule> getIndexSpecRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing index spec rules.
      Specified by:
      getIndexSpecRules in interface ReindexingRuleProvider
    • getIndexSpecRule

      @Nullable public ReindexingIndexSpecRule getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns 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:
      getIndexSpecRule in interface ReindexingRuleProvider
      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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object