ashwintumma23 opened a new pull request, #19635:
URL: https://github.com/apache/druid/pull/19635

   ### Description
   
   This PR adds a `skipOffsetFromEarliest` parameter to the compaction 
configuration, providing the inverse functionality of the existing 
`skipOffsetFromLatest` parameter. This allows users to skip re-compacting older 
historical data while experimenting with compaction configuration changes on 
recent data.
   
   #### Problem
   
   Currently, Druid supports `skipOffsetFromLatest` to 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:
   
   1. **Changing partition dimensions** - When experimenting with new partition 
dimensions on large tables, all historical data gets re-compacted unnecessarily
   2. **Switching shard specs** (dynamic ↔ range) - Triggers re-compaction of 
the entire dataset
   3. **Long-retention tables** - Tables with months of historical data where 
old segments don't need re-compaction
   
   #### Solution
   
   Added `skipOffsetFromEarliest` field that works symmetrically to 
`skipOffsetFromLatest`:
   - `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:
   ```json
   {
     "dataSource": "my_datasource",
     "skipOffsetFromEarliest": "P30D",  // Skip first 30 days
     "skipOffsetFromLatest": "P1D"      // Skip last 1 day
   }
   ```
   
   #### Implementation Details
   
   - **DataSourceCompactionConfig interface**: Added 
`getSkipOffsetFromEarliest()` with default `Period.ZERO`
   - **InlineSchemaDataSourceCompactionConfig & 
CatalogDataSourceCompactionConfig**: Implemented field with JSON serialization
   - **DataSourceCompactibleSegmentIterator**: Added 
`computeEarliestSkipInterval()` method (mirror of `computeLatestSkipInterval()`)
   - **Skip interval merging**: Updated `sortAndAddSkipIntervals()` to handle 
both earliest and latest skip intervals
   - **CascadingReindexingTemplate**: Added support with validation to ensure 
mutual exclusivity of skip offset strategies
   - **Backward compatibility**: New field is optional and defaults to 
`Period.ZERO` (no skipping), ensuring no breaking changes
   
   #### Release note
   
   Added `skipOffsetFromEarliest` compaction configuration parameter to skip 
re-compacting old historical data. This complements the existing 
`skipOffsetFromLatest` parameter 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.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `DataSourceCompactionConfig`
    * `InlineSchemaDataSourceCompactionConfig`
    * `CatalogDataSourceCompactionConfig`
    * `DataSourceCompactibleSegmentIterator`
    * `CascadingReindexingTemplate`
    * `DataSourceCompactibleSegmentIteratorSkipOffsetTest`
   
   <hr>
   
   This PR has:
   
   - [x] been self-reviewed.
   - [ ] added documentation for new or modified features or behaviors.
   - [x] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to