-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
MSQ generates tombstones honoring granularity specified in a REPLACE
query.
#15243
MSQ generates tombstones honoring granularity specified in a REPLACE
query.
#15243
Conversation
This change tweaks to only account for the infinite-interval tombstones. For finite-interval tombstones, the MSQ query granualrity will be used which is consistent with how MSQ works.
REPLACE
query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I like the idea of having the tombstone behavior be better aligned between native and MSQ. I'm not sure if there's a reason that it needs to be different.
Couple comments:
- Looks like
TombstoneHelper
hascomputeTombstones
used by native batch in replace mode, andcomputeTombstoneSegmentsForReplace
used by MSQ in replace mode. Is there a practical difference in the logic? If so— is it a difference we need to preserve, or could both systems use the same method? It looks like the method used by MSQ was added in Generate tombstones when running MSQ's replace #13706. Perhaps the PR has some discussion that would shed light on these questions. - Ideally MSQ would return a
TooManyBuckets
fault if there are more than 5000 tombstones (StageDefinition.PARTITION_STATS_MAX_BUCKETS
). To support this I suggest adding a limit parameter toTombstoneHelper
, so there's some way for a caller to tell if the limit is exceeded. This prevents OOM in situations where there are too many time chunks. It also aligns with the behavior of an ingest that generates actual data as opposed to tombstones.
Thank you for the review, @gianm!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since TooManyBucketsFault now also includes tombstones, does the user-facing message for the error still hold, or do we want it to be more explanatory?
Expressing "tombstones" in the message doesn't seem neat, so I think we can mention the number of buckets generated & the number of empty buckets in the message to help the user & admin debug faster, without saying what tombstones are.
...vice/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TombstoneHelper.java
Outdated
Show resolved
Hide resolved
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQReplaceTest.java
Outdated
Show resolved
Hide resolved
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/ControllerImpl.java
Outdated
Show resolved
Hide resolved
@LakshSingla re:
The user-facing error message would still be (also in
Did you mean the cause in the stacktrace? If so, I think it's better to be direct and say "tombstone" in the cause since it's an existing concept explained in the Druid docs. The stacktrace for completeness:
|
I meant the user facing message. We can enhance the message to include more information about what the user is doing, and how many buckets they are generating.
I guess so, though tombstones isn't something that we expect a user to be familiar with. |
e8011aa
to
46749ab
Compare
46749ab
to
8bb2c38
Compare
@LakshSingla, thank you for the review! Regarding mentioning the total # of buckets a query would generate without the max buckets limit, the computation could lead to an OOM. The I believe I've addressed your comments. Can you please take another look? |
extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/exec/MSQFaultsTest.java
Show resolved
Hide resolved
...vice/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/TombstoneHelper.java
Outdated
Show resolved
Hide resolved
…` query. (apache#15243) * MSQ generates tombstones honoring the query's granularity. This change tweaks to only account for the infinite-interval tombstones. For finite-interval tombstones, the MSQ query granualrity will be used which is consistent with how MSQ works. * more tests and some cleanup. * checkstyle * comment edits * Throw TooManyBuckets fault based on review; add more tests. * Add javadocs for both methods on reconciling the methods. * review: Move testReplaceTombstonesWithTooManyBucketsThrowsException to MsqFaultsTest * remove unused imports. * Move TooManyBucketsException to indexing package for shared exception handling. * lower max bucket for tests and fixup count * Advance and count the iterator. * checkstyle
…` query. (apache#15243) * MSQ generates tombstones honoring the query's granularity. This change tweaks to only account for the infinite-interval tombstones. For finite-interval tombstones, the MSQ query granualrity will be used which is consistent with how MSQ works. * more tests and some cleanup. * checkstyle * comment edits * Throw TooManyBuckets fault based on review; add more tests. * Add javadocs for both methods on reconciling the methods. * review: Move testReplaceTombstonesWithTooManyBucketsThrowsException to MsqFaultsTest * remove unused imports. * Move TooManyBucketsException to indexing package for shared exception handling. * lower max bucket for tests and fixup count * Advance and count the iterator. * checkstyle
…` query. (apache#15243) * MSQ generates tombstones honoring the query's granularity. This change tweaks to only account for the infinite-interval tombstones. For finite-interval tombstones, the MSQ query granualrity will be used which is consistent with how MSQ works. * more tests and some cleanup. * checkstyle * comment edits * Throw TooManyBuckets fault based on review; add more tests. * Add javadocs for both methods on reconciling the methods. * review: Move testReplaceTombstonesWithTooManyBucketsThrowsException to MsqFaultsTest * remove unused imports. * Move TooManyBucketsException to indexing package for shared exception handling. * lower max bucket for tests and fixup count * Advance and count the iterator. * checkstyle
…`REPLACE` query. (apache#15243)" This reverts commit 2e79fd5.
Unlike native batch ingestion, MSQ is strict about segment allocation -- it will throw an
InsertCannotAllocateSegment
fault if the requested segment granularity doesn't align with the allocated segment granularity.This patch modifies the segment generation logic in MSQ
REPLACE
to:Limits.MAX_PARTITION_BUCKETS
) - e.g.,[2000, 2010)
. Once the limit exceeds, aTooManyBucketsFault
fault is returned similar to data segments.[-Inf, 2000)
,[2010, Inf)
.This behavior is consistent with how MSQ generally works re honoring segment granularity in the query. It's also similar to how native batch ingestion generates tombstones.
Description
Previously MSQ replace would generate "irregular" tombstones as an optimization so the controller doesn't run OOM. The new code only treats the infinite interval ones special, which will be cleaned up by the coordinator in a follow up change.
This change semi-reverts #13893, uses the tests added in the PR and adds a new condition to account for the infinite-interval tombstones.
Release note
MSQ
REPLACE
queries will generate tombstone segments honoring the segment granularity specified in the query. If a query generates more than 5000 tombstones, it'll return an MSQTooManyBucketsFault
to the user, similar to the behavior with data segments.Key changed/added classes in this PR
TombstoneHelper.java
TombstoneHelperTest.java
This PR has: