maytasm opened a new pull request #12334:
URL: https://github.com/apache/druid/pull/12334
Fix auto compaction task interval when segmentGranularity is set
### Description
This bug can cause data lost if segmentGranularity is set in auto
compaction.
If segmentGranularity is set, then the segmentGranularity of the segments
may not align with the configured segmentGranularity. We must adjust the
interval of the compaction task to fully cover and align with the
segmentGranularity to prevent unexpected data lost.
For example,
- The umbrella interval of the segments is 2015-04-11/2015-04-12 but
configured segmentGranularity is YEAR, if the compaction task's interval is
2015-04-11/2015-04-12 then we can run into race condition where after
submitting the compaction task, a new segment outside of the interval (i.e.
2015-02-11/2015-02-12) got created will be lost as it is overshadowed by the
compacted segment (compacted segment has interval 2015-01-01/2016-01-01. Hence,
in this case, we must adjust the compaction task interval to
2015-01-01/2016-01-01.
- The umbrella interval of the segments is 2015-02-01/2015-03-01 but
configured segmentGranularity is MONTH, if the compaction task's interval is
2015-02-01/2015-03-01 then compacted segments created will be
2015-01-26/2015-02-02, 2015-02-02/2015-02-09, 2015-02-09/2015-02-16,
2015-02-16/2015-02-23, 2015-02-23/2015-03-02. The compacted segment would cause
existing data from 2015-01-26 to 2015-02-01 and 2015-03-01 to 2015-03-02 to be
lost. Hence, in this case, we must adjust the compaction task interval to
2015-01-26/2015-03-02
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] 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.
- [ ] 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]