-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[WIP] Split partition-level bucket-count support into focused PRs #9370
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
Open
dwangatt
wants to merge
29
commits into
apache:master
Choose a base branch
from
atlassian-forks:dwang/continue-pr-7865
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
5cf7b02
Support per-partition buckets
mikedias f9b0a1f
Optimize PartitionBucketMapping.loadFromTable
mikedias 81f5d44
Fix rescaling via INSERT OVERWRITE
mikedias 012e72a
Fix empty-bucket from WriteRestore scenario
mikedias 0d363ce
Fixing corner case for non-partitioned tables
mikedias 9c784bf
Fix merge commutativity, fail fast on scan error, and add streaming r…
mikedias 2360910
Improve how we test the BUCKET_APPEND_ORDERED behaviour
mikedias 45f657f
Merge branch 'master' into mdias/master/buckets-per-partition
mikedias cc5a260
Fix conflicts with TableWriteCoordinator
mikedias ede2957
Merge branch 'master' into mdias/master/buckets-per-partition
mikedias c5172e8
Reject bucket writes outside partition layout
mikedias d06e210
Update docs to reflect the limitations around Spark
mikedias c37b785
docs tweaking
mikedias ed95279
merge with master
mikedias 49dbe75
trailing whitespaces
mikedias e0d5bd1
Add bucket.per-partition-count-enabled config
mikedias ffcd6ea
merge with master
mikedias 1bd7597
Validate the option before allowing divergent bucket writing
mikedias 5500330
fix ReadWriteTableITCase
mikedias a0d1240
Merge apache/master and guard partition bucket mismatches
dwangatt 589d275
Preserve FixedBucketWriteSelector constructor compatibility
dwangatt 4062a90
Preserve postpone bucket restore semantics
dwangatt 219235c
Trigger CI
dwangatt 78f06c7
Clarify partition bucket mapping serialization
dwangatt 45d5844
Retry Kafka topic cleanup timeouts in tests
dwangatt e6c0d6d
fix: reject Spark writes with per-partition buckets
dwangatt e0808e5
Merge branch 'master' into dwang/continue-pr-7865
dwangatt a6255e4
fix: reject Spark writes with per-partition buckets
dwangatt 15916bb
Merge branch 'master' into dwang/continue-pr-7865
dwangatt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
[P1] The relaxed bucket check silently accepts mis-routed rows on the Flink path.
bucket >= restoredTotalBucketsis a range check, not a routing check, and it cannot detect the failure this feature makes reachable.The routing mapping is frozen at job submission:
FlinkSinkBuilderbuildsnew RowDataChannelComputer(sinkTable.createRowKeyExtractor())on the client, andRowKeyExtractorwas madeSerializablein this PR precisely so thePartitionBucketMappingships with the job graph. A long-running streaming job therefore keeps routing with the bucket layout that existed at submission time, and the mapping is never refreshed afterwards.Consider a partition rescaled from 4 to 8 buckets while a streaming job is running. The router still computes
h % 4 = b, which is in[0, 4); the true bucket ish % 8, which is eitherborb + 4. Sinceb < 8, the range check passes for every row, and roughly half of them are written into the wrong bucket with only aLOG.info. On a primary-key table the same key then lives in two buckets — duplicates and lost updates, with no error surfaced at any layer. (Downscaling is caught only accidentally, and only for power-of-two counts; e.g. 6 -> 4 also mis-routes silently forh = 8.)The writer cannot currently do better, because
expectedTotalBucketshere is the table-level count: the Flink fixed-bucket path goesTableWriteImpl.writeAndReturn(row, bucket, null)->write(partition, bucket, data)->createWriterContainer(partition, bucket, numBuckets, ...), wherenumBuckets = options.bucket(). The bucket count the router actually used never reaches the writer, so there is nothing meaningful to comparerestoredTotalBucketsagainst.Suggestion: plumb the routing bucket count (
PartitionBucketMapping.resolveNumBuckets(partition)) through to the writer — thewrite(partition, bucket, totalBuckets, data)overload already exists — and fail when it disagrees withrestoredTotalBuckets. That is precise rather than heuristic, and it does not break the feature: a batch job or a freshly started streaming job loads a current mapping, so the two agree and nothing fails. It fails only when the mapping is stale, which is exactly the corruption case thatdocs/docs/maintenance/rescale-bucket.mdcurrently addresses with "Streaming jobs must be restarted after rescaling a partition" — a guideline that cannot be enforced, as @JingsongLi already noted above.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.
Thanks @zhuxiangyi that's a good point. I updated PR to fail job when bucket does not match.