[bugfix] Fixing instance partition assignments for multi-stream realtime tables#18433
Open
shauryachats wants to merge 3 commits intoapache:masterfrom
Open
[bugfix] Fixing instance partition assignments for multi-stream realtime tables#18433shauryachats wants to merge 3 commits intoapache:masterfrom
shauryachats wants to merge 3 commits intoapache:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18433 +/- ##
============================================
+ Coverage 63.57% 63.58% +0.01%
Complexity 1717 1717
============================================
Files 3252 3252
Lines 199132 199144 +12
Branches 30875 30877 +2
============================================
+ Hits 126596 126627 +31
+ Misses 62454 62437 -17
+ Partials 10082 10080 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Multi-stream realtime tables encode Pinot partition IDs as
streamIndex * 10000 + streamPartitionId. Before this fix, RealtimeSegmentAssignment and ReplicaGroupSegmentAssignmentStrategy used the raw (encoded) partition ID directly when computing instance slots, causing incorrect slot mapping and breaking colocation of segments belonging to the same partition.Changes:
RealtimeSegmentAssignment.assignConsumingSegment, decode the Pinot partition ID to the stream-level partition ID viaIngestionConfigUtils.getStreamPartitionIdFromPinotPartitionIdbeforecomputing the instance index.
ReplicaGroupSegmentAssignmentStrategy, extract agetPartitionIdFromSegmentNamehelper that applies the same decoding for REALTIME tables before% numPartitions, fixing both single-segment assignment and rebalance paths.Testing
Deployed this on an internal cluster containing a multi-topic table and verified by setting the
instanceAssignmentConfigas:For this setup, the raw partition ID
0and10000would map to instance partition0 % 3 = 0and10000 % 3 = 1without the fix which meant different servers for the same stream partition ID which breaks colocation of data.After the fix, both
0and10000would map to the correct instance partition0 % 3 = 0and(10000 % 10000) % 3 = 0.