-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
ddl: fix alter table share rowid bit problem #9868
Conversation
Please merge pingcap/parser#252 first. |
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.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #9868 +/- ##
===============================================
- Coverage 78.1391% 78.121% -0.0182%
===============================================
Files 405 405
Lines 82005 82033 +28
===============================================
+ Hits 64078 64085 +7
- Misses 13231 13248 +17
- Partials 4696 4700 +4 |
Co-Authored-By: crazycs520 <crazycs520@gmail.com>
…to fix-share-bit
/run-all-tests |
1 similar comment
/run-all-tests |
LGTM |
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.
LGTM
/run-all-tests |
/run-all-tests |
/rebuild |
What problem does this PR solve?
There is some problem in share rowid bits. Think about follow situation.
The current SHARD_ROW_ID_BITS = 6, then, after alter SHARD_ROW_ID_BITS = 4,
What is changed and how it works?
Add a
MaxShardRowIDBits
to tableInfo to record the max ShardRowIDBits has been used.Then use
MaxShardRowIDBits
to check autoID overflow.Then in upper situation, after SHARD_ROW_ID_BITS = 4, TiDB will also use 6 to check allocateAutoID overflow. then the duplicate ID cannot be insert , because the duplicated ID is overflow with MaxShardRowIDBits=6.
Related Parser PR: pingcap/parser#252, Pleaser merge parser first.
Check List
Tests
Code changes
Side effects
Related changes