Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation of empty segment IDs in markUsed and markUnused APIs #16145

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

abhishekrb19
Copy link
Contributor

@abhishekrb19 abhishekrb19 commented Mar 18, 2024

Description:

Before this patch, isValid() treated empty segment IDs inconsistently. Consider the following scenarios with each parameter to markUsed and markUnused APIs and their outcomes:

  1. Interval = null & segment IDs = null: Invalid
  2. Interval = non-null & segment IDs = []: Invalid
  3. Interval = non-null & segment IDs = null: Valid
  4. Interval = null & segment IDs = []: Invalid

Note that in scenario 2, empty segment IDs are treated as the existence of the parameter. On the other hand, in scenario 4, empty segment IDs are treated as the absence of the parameter, which is confusing from an API user's perspective.

Fix:

With this patch, empty segment IDs are treated the same as null, indicating the absence of the parameter. So the outcome of scenario 2 will be Valid.

Added unit tests for the missing scenarios and updated the expectations of a couple of existing unit tests.

Release note

Fixed a bug in the markUsed and markUnused APIs where an empty set of segment IDs would be inconsistently treated as null or non-null in different scenarios.

This PR has:

  • been self-reviewed.
  • a release note entry in the PR description.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • been tested in a test Druid cluster.

…me time.

Treat empty and null segment IDs as the same.
@abhishekrb19 abhishekrb19 changed the title Fix validation of markUsed and markUnused APIs Fix validation of empty segment IDs in markUsed and markUnused APIs Mar 18, 2024
@abhishekrb19 abhishekrb19 merged commit 3b35fb7 into apache:master Mar 18, 2024
84 checks passed
@abhishekrb19 abhishekrb19 deleted the empty_segments_bug branch March 18, 2024 07:47
@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants