kfaraz opened a new pull request #11190:
URL: https://github.com/apache/druid/pull/11190
Compaction Tasks, both auto and manual, try to acquire locks on the
Datasource Intervals which they need to compact. If a higher priority ingestion
task is in progress for an overlapping interval, the compaction task waits
until it can acquire a lock. This can lead to the following potential issues:
- Due to poor configuration of `skipOffsetFromLatest`, compaction can get
stuck for long periods of time.
- Once the lock is released by the ingestion task, it is possible that some
new segments are published (and/or removed). This invalidates the segment spec
in the compaction task, causing it to fail. Such failures are unnecessary and
often difficult to debug.
### Resolution
Rather than waiting on already locked intervals, we can proceed to the
compaction of other intervals (these would be older intervals, if the
compaction policy is Newest First). When the locked intervals are freed up,
subsequent compaction runs can submit compaction tasks for them.
In every compaction run (invocation of`CompactSegments.run()`)
- the Coordinator makes a call to the Overlord API `/lockedIntervals`
- the Overlord returns a list of intervals locked by each currently running
task, using the
in-memory state of the `TaskLockbox`
- the Coordinator then skips the locked intervals while submitting
compaction tasks
### Code Changes:
* Add class `DatasourceIntervals` to encapsulate a datasource name and a
List of Intervals
* Add response class `LockedIntervalsResponse`
* Add Overlord REST endpoint `/druid/indexer/v1/lockedIntervals`
* Use the above API in `CompactSegments.run()` to skip locked intervals
<hr>
<!-- Check the items by putting "x" in the brackets for the done things. Not
all of these items apply to every PR. Remove the items which are not done or
not relevant to the PR. None of the items from the checklist below are strictly
necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [x] 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.)
- [x] added documentation for new or modified features or behaviors.
- [x] 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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]