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 for OOM in the Tombstone generating logic in MSQ #13893

Merged
merged 3 commits into from
Mar 9, 2023

Conversation

LakshSingla
Copy link
Contributor

While generating tombstones for MSQ (#13706) the controller might run into OOM while trying to compute the intervals for which the tombstones need to be generated because we are materializing all the intervals which need to be marked by a tombstone, partitioned by granularity. So for a query that replaces over all, and the existing data source contains a segment for the eternity, this would generate a large number of intervals (given a finite granularity such as DAY).

This PR changes the behavior of the tombstones generating logic wherein for the overlap, we only generate completely disjointed tombstones so that the number of intervals for which tombstones need to be generated do not explode.

Release note

(none)


Key changed/added classes in this PR
  • TombstoneHelper
  • TombstoneHelperTest

This PR has:

  • been self-reviewed.
  • [] 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
  • 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 is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@@ -147,7 +147,7 @@ public void tombstoneIntervalsCreatedForReplaceWhenReplaceIsContainedInUsedInter
replaceGranularity
);
Assert.assertEquals(
ImmutableSet.of(Intervals.of("2020-03-05/2020-03-06"), Intervals.of("2020-03-06/2020-03-07")),
ImmutableSet.of(Intervals.of("2020-03-05/2020-03-07")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the tests complete? That is, do we have, say replace a day into ALL?

Replace a day into YEAR with:

  • Day as Jan 1. (I.e. one tombstone on the right)
  • Day as Feb. 1. (Two tombstones)
  • Day as Dec. 31. (One tombstone on the left)

Do we have a case for the non-aligned case? Original is month, target is week. (Although, I know we don't want to support week. It is still a useful non-aligned test case.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, the aligned test cases were there. Added a few test cases with the abovementioned criteria, and added the case which would have caused OOM earlier.

LakshSingla and others added 2 commits March 9, 2023 02:10
…n/task/batch/parallel/TombstoneHelper.java

Co-authored-by: Paul Rogers <[email protected]>
Copy link
Contributor

@paul-rogers paul-rogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM.

@paul-rogers paul-rogers merged commit dc67296 into apache:master Mar 9, 2023
cryptoe pushed a commit that referenced this pull request Mar 10, 2023
…13907)

* As a follow up to #13893, this PR improves the comments added along with examples for the code, as well as adds handling for an edge case where the generated tombstone boundaries were overshooting the bounds of MIN_TIME (or MAX_TIME).
317brian pushed a commit to 317brian/druid that referenced this pull request Mar 10, 2023
fix OOMs using a different logic for generating tombstones

---------

Co-authored-by: Paul Rogers <[email protected]>
@asdf2014 asdf2014 added the Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 label Mar 30, 2023
@clintropolis clintropolis added this to the 26.0 milestone Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants