sql/mysql: add AUTO_RANDOM support for TiDB#3657
Open
negachov wants to merge 3 commits intoariga:masterfrom
Open
sql/mysql: add AUTO_RANDOM support for TiDB#3657negachov wants to merge 3 commits intoariga:masterfrom
negachov wants to merge 3 commits intoariga:masterfrom
Conversation
|
This seems to be much better than my #3659 adding this same support in a much more naive way. |
|
@a8m Could you please review this PR? Thanks! |
- Tighten reAutoRandom regex to only match TiDB /*T![auto_rand] comments - Add checkUnsupportedChanges for AUTO_RANDOM modification/removal detection - Refactor ColumnChange to detect AUTO_RANDOM removal (previously ignored) - Replace magic numbers with AutoRandom constants - Improve error messages in setCollate, setAutoRandom, setAutoIncrement - Add defensive nil checks in priority() and patchColumn() - Fix bytesToBitLiteral to handle >8 byte inputs - Rename shadowed variable in flat()
fae9f64 to
1b77502
Compare
Author
|
Author
|
Hi @giautm , could you take a look at this PR when you get a chance? Happy to address any feedback. Thanks! |
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.
Add end-to-end support for TiDB's
AUTO_RANDOMcolumn attribute, which generates random unique IDs on BIGINT primary key columns to avoid write hotspots.AUTO_RANDOM(shard_bits[, range_bits])fromCREATE TABLEstatement, supporting TiDB v5 through v8+ (v8 no longer populates theEXTRAcolumn inINFORMATION_SCHEMA)AUTO_RANDOM; ignore removal (unsupported by TiDB)AUTO_RANDOM(S)/AUTO_RANDOM(S, R)inCREATE TABLEandALTER TABLEauto_random(shard bits) andauto_random_range(range bits) attributes with validation and round-trip supportRangeBits=64(TiDB default) to0across all paths to prevent spurious diffsWe are planning to contribute more TiDB-specific improvements. Would it be welcome to send these as incremental PRs?