capistrant opened a new pull request, #20063: URL: https://github.com/apache/druid/pull/20063
### Description #### Race Condition Definition and Example With the introduction of historical tier aliasing in coordinator dynamic configs #19204, we introduced a minor race condition in the Coordinator `RunRules` and `UnloadUnusedSegments` duties. These duties dynamically access the defined Druid [retention rules](https://druid.apache.org/docs/latest/operations/rule-configuration/) intra-run. The issue with this is that the alias mapping comes from dynamic configs which are snapshotted per coordinator run cycle. This exposes operators to an issue when they migrate to using tier aliases in their load rules: 1. coordinator duty cycle snapshots dynamic config with no tier aliases and begins running duties 2. operator adds a tier alias mapping to their dynamic config 3. operator updates their load rules to reference the tier alias instead of the raw tiers 4. run rules now starts trying to apply rules based on the rules that reference the alias. But the alias is not known to the coordinator yet! The above flow can result in the cluster seeing the segments overloaded on unknown tiers and dropping all replicas even though the cluster was fully loaded on the correct tiers via tier aliases. #### Proposed Solution Snapshot the rules map for all datasources and store it in the coordinator runtime params (same place the snapshotted dynamic config goes). This means there is no dynamic application of updated rules map if it is modified mid coordinator duty loop. #### Release note Fixes a race condition where a cluster can temporarily drop data from historicals while an operator migrates load rule definitions to use historical tier aliasing. <hr> ##### Key changed/added classes in this PR * `DruidCoordinatorRuntimeParams` * `RunRules` * `UnloadUnusedSegments` <hr> 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]
