AmatyaAvadhanula opened a new pull request, #16380:
URL: https://github.com/apache/druid/pull/16380
### Bug
Consider a situation where there are:
1) No used segments
2) Unused segments with ids ranging from 1 to 10
3) Pending segments with ids ranging from 1 to 5 due to partial clean up
Previously, new segment allocations would consider only used and pending
segments and allocate a segment with id 6.
This is problematic as it conflicts with an existing unused entry in the
segments table.
### Changes
After a segment has been allocated, check that it doesn't correspond to any
used or unused segment id in druid_segments table.
If it does, try to look at the unused segments and increment the
partitionNum to max(unusedSegment.partitionNum) + 1 if needed.
Even though this requires fetching all unused segments for a given
(datasource, version, interval) when there is a conflict, the conflict would
arise due to unused segments at most once and would not affect batch segment
allocation's performance.
### Alternatives
Unused pending segments must be cleaned up or ignored when they are not
associated with any existing active lock.
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.)
- [ ] 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)
- [x] 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]