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

   ### Description
   
   This change enables the `KillUnusedSegments` coordinator duty to be 
scheduled continously in a custom duty group. Things that prevented this, or 
made this difficult before were the following:
   
   1. The `druid.coordinator.kill.period` was forced to be set greater than the 
`druid.coordinator.period.indexingPeriod`
   
   2. If scheduled at fast enough rate, the duty would find the same intervals 
to kill for the same datasources, while kill tasks submitted for those same 
datasources and intervals were already underway, thus wasting task slots on 
duplicated work.
   
   3. The task resources used by auto kill were previously unbounded.  Each 
duty run period, if unused
    segments were found for any datasource, a kill task would be submitted to 
kill them.
   
   This pr solves for both of these issues:
   
   1. The `druid.coordinator.kill.period` is now permitted to be null, and is 
defaulted as null. If set to null, the duty is scheduled at the same period as 
`druid.coordinator.period.indexingPeriod`.
   
   2. The duty keeps track of the end time of the last interval found when 
killing unused segments for each datasource, in a in memory map. The end time 
for each datasource, if found, is used as the start time lower bound, when 
searching for unused intervals for that same datasource. Each duty run, we 
remove any datasource keys from this map that are no longer found to match 
datasources in the system, or in whitelist, and also remove a datasource entry, 
if there is found to be no unused segments for the datasource, which happens 
when we fail to find an interval which includes unused segments.
   
   3. The unbounded task resource usage can be mitigated with coordinator 
dynamic config added as part of 
https://github.com/apache/druid/commit/ba957a9b97b6bdbecb166db771721cced1dac365
   
   
   Operators can configure continous auto kill by providing coordinator runtime 
properties similar to the following:
   
   ```
   druid.coordinator.dutyGroups=["customKill"]
   druid.coordinator.customKill.duties=["KillUnusedSegments"]
   druid.coordinator.customKill.period=PT1S
   ```
   
   And providing sensible limits to the killTask usage via coordinator dynamic 
properties.
   
   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.
   - [ ] 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.
   - [ ] 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