feat: Add skipOffsetFromEarliest to compaction configuration#19635
Draft
ashwintumma23 wants to merge 5 commits into
Draft
feat: Add skipOffsetFromEarliest to compaction configuration#19635ashwintumma23 wants to merge 5 commits into
ashwintumma23 wants to merge 5 commits into
Conversation
This commit adds a skipOffsetFromEarliest parameter to the compaction configuration, providing the inverse functionality of skipOffsetFromLatest. This allows users to skip re-compacting older data while experimenting with changes to recent data. Changes include: - Add skipOffsetFromEarliest field to DataSourceCompactionConfig interface with default value of Period.ZERO (no skipping) - Implement in InlineSchemaDataSourceCompactionConfig and CatalogDataSourceCompactionConfig with JSON serialization support - Add computeEarliestSkipInterval() method to DataSourceCompactibleSegmentIterator for computing skip interval from earliest timestamp - Update sortAndAddSkipIntervals() to handle both earliest and latest skip offsets - Support in CascadingReindexingTemplate with validation to ensure mutual exclusivity of skipOffsetFromNow, skipOffsetFromLatest, and skipOffsetFromEarliest - Add unit tests in DataSourceCompactibleSegmentIteratorSkipOffsetTest
added 4 commits
June 29, 2026 05:16
Update test files to include the new skipOffsetFromEarliest parameter in CatalogDataSourceCompactionConfig constructor calls: - CatalogDataSourceCompactionConfigTest: Add null for skipOffsetFromEarliest - CompactSegmentsTest: Add null for skipOffsetFromEarliest
Add skipOffsetFromEarliest parameter (null) to all CascadingReindexingTemplate constructor calls in test file. The new parameter goes between skipOffsetFromLatest and skipOffsetFromNow parameters.
Add missing skipOffsetFromEarliest parameter to exception test constructors: - test_constructor_setBothSkipOffsetStrategiesThrowsException - test_constructor_nullDataSourceThrowsException - test_constructor_nullRuleProviderThrowsException - test_constructor_nullDefaultSegmentGranularityThrowsException - test_constructor_tuningConfigWithPartitionsSpecThrowsException Also update assertion for setBothSkipOffsetStrategiesThrowsException to match the new error message format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a
skipOffsetFromEarliestparameter to the compaction configuration, providing the inverse functionality of the existingskipOffsetFromLatestparameter. This allows users to skip re-compacting older historical data while experimenting with compaction configuration changes on recent data.Problem
Currently, Druid supports
skipOffsetFromLatestto avoid re-compacting recent data (e.g., last 24 hours). However, there is no way to skip re-compacting old historical data. This becomes problematic in scenarios such as:Solution
Added
skipOffsetFromEarliestfield that works symmetrically toskipOffsetFromLatest:skipOffsetFromLatest: Skips data from the END of the timeline (latest timestamp - offset, latest timestamp)skipOffsetFromEarliest: Skips data from the START of the timeline (earliest timestamp, earliest timestamp + offset)Example configuration:
{ "dataSource": "my_datasource", "skipOffsetFromEarliest": "P30D", // Skip first 30 days "skipOffsetFromLatest": "P1D" // Skip last 1 day }Implementation Details
getSkipOffsetFromEarliest()with defaultPeriod.ZEROcomputeEarliestSkipInterval()method (mirror ofcomputeLatestSkipInterval())sortAndAddSkipIntervals()to handle both earliest and latest skip intervalsPeriod.ZERO(no skipping), ensuring no breaking changesRelease note
Added
skipOffsetFromEarliestcompaction configuration parameter to skip re-compacting old historical data. This complements the existingskipOffsetFromLatestparameter and is useful when experimenting with partition dimensions or shard spec changes on large tables where you want to apply changes only to recent data.Key changed/added classes in this PR
DataSourceCompactionConfigInlineSchemaDataSourceCompactionConfigCatalogDataSourceCompactionConfigDataSourceCompactibleSegmentIteratorCascadingReindexingTemplateDataSourceCompactibleSegmentIteratorSkipOffsetTestThis PR has: