VReplication: Support automatically replacing auto_inc cols with sequences#16860
VReplication: Support automatically replacing auto_inc cols with sequences#16860mattlord merged 26 commits intovitessio:mainfrom
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
82a1670 to
eec4b9c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16860 +/- ##
========================================
Coverage 69.42% 69.43%
========================================
Files 1571 1571
Lines 203304 203433 +129
========================================
+ Hits 141148 141249 +101
- Misses 62156 62184 +28 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
eec4b9c to
33b4cc9
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
1c85d2a to
e56dd5b
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
f462d86 to
21b2871
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
21b2871 to
f5eb4e2
Compare
5f28cfa to
ea0d3ad
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
ea0d3ad to
b110120
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
669a5f7 to
e89bbf7
Compare
Signed-off-by: Matt Lord <mattalord@gmail.com>
|
We'll run the website docs update for the vtctld command reference once before release. |
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
| - **[Automatically Replace MySQL auto_increment Clauses with Vitess Sequences](#auto-replace-mysql-autoinc-with-seq)** | ||
|
|
||
| ## <a id="major-changes"/>Major Changes | ||
| ## <a id="major-changes"/>Major Changes</a> |
There was a problem hiding this comment.
Was adding </a> to every section heading done by your editor? Seems unnecessary.
There was a problem hiding this comment.
I did it as w/o it the content is messed up in some readers (the preview one I use). It’s proper to end it.
changelog/21.0/21.0.0/summary.md
Outdated
|
|
||
| ### <a id="auto-replace-mysql-autoinc-with-seq"/>Automatically Replace MySQL auto_increment Clauses with Vitess Sequences</a> | ||
|
|
||
| When migrating tables from an unsharded keyspace to a sharded one using the [VReplication `MoveTables` command](https://vitess.io/docs/reference/vreplication/movetables/), we now support |
There was a problem hiding this comment.
This is too verbose for a summary. Can you please condense it into a short paragraph? No need to give all the background, just describe the feature briefly.
There was a problem hiding this comment.
In my mind if we add something to the summary we think it’s worth highlighting. At a minimum we should then describe what the thing is that we’re highlighting and explain why we think it’s worth highlighting. Which to me includes the context for what it is, what it is, why it’s important, when you'd use it, and how to use it. Two paragraphs is not a lot IMO and if you look at this and previous summary docs multiple paragraphs is quite common (just look at the one right above this). That being said, I will try and condense it and eliminate some content that isn’t strictly necessary for the stated objectives.
There was a problem hiding this comment.
I created a docs PR for this: vitessio/website#1859
Once that's merged this can become a short paragraph that links to this for additional details: https://deploy-preview-1859--vitess.netlify.app/docs/21.0/reference/vreplication/movetables/#auto-increment-handling
Signed-off-by: Matt Lord <mattalord@gmail.com>
* Update reference docs for vitessio/vitess#16860 Signed-off-by: Matt Lord <mattalord@gmail.com> * Add new section to the movetables reference page Signed-off-by: Matt Lord <mattalord@gmail.com> * Add keyspace concept link Signed-off-by: Matt Lord <mattalord@gmail.com> * Changes from self review Signed-off-by: Matt Lord <mattalord@gmail.com> * Correct keyspace concept link Signed-off-by: Matt Lord <mattalord@gmail.com> * Minor tweak Signed-off-by: Matt Lord <mattalord@gmail.com> * Unify formatting Signed-off-by: Matt Lord <mattalord@gmail.com> --------- Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Matt Lord <mattalord@gmail.com>
Description
Since #15679 we automatically strip any MySQL
auto_incrementclauses on tables that are being moved (using theMoveTablescommand) from an unsharded keyspace to a sharded one. And since #13656 we support initializing any sequences in the target keyspace onSwitchTraffic.In this PR, we build upon both of those items of work to support automatically creating a Vitess Sequence for each if those tables that HAD an
auto_incrementclause if one does not already exist. This requires the use of two flags:- That we want to replace any removed MySQL auto_increment clauses with vschema AutoIncrement definitions using
--sharded-auto-increment-handling=replace- An unsharded keyspace in
--global-keyspacethat we can then later use to create the sequence tables in if they don't already exist (they don't in the manual test below)--initialize-target-sequencesflag, which will create a missing sequence table when possibleManual test
Results:
The
strip_sharded_auto_incrementfield was renamed tosharded_auto_increment_handling— which is upgrade/downgrade safe with protobufs as field indexes are used — and the type of the proto field was changed fromboolto anenum/int32to support the new REPLACE option. This is upgrade/downgrade safe because the wire format for bool is avarintwith 0 being false and 1 being true — with the deserialization ending up 0 = false > 0 = true. To demonstrate:And using the manual test case from above but using binaries built on
mainwith avtctldclientbinary from the PR branch:So we can see that the auto_increment clauses were still removed.
Related Issue(s)
Checklist