Closed mattlord closed 1 month ago
Hello reviewers! :wave: Please follow this checklist when reviewing this Pull Request.
release notes (needs details)
label if users need to know about this change.-
), and have a clear help text.Jobs
should be named in order to mark it as required
.required
, the maintainer team must be notified._vt
tables and RPCs need to be backward compatible.vtctl
command output order should be stable and awk
-able.Attention: Patch coverage is 68.27586%
with 46 lines
in your changes missing coverage. Please review.
Project coverage is 69.43%. Comparing base (
945124a
) to head (1d8601a
). Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
We'll run the website docs update for the vtctld command reference once before release.
Description
Since https://github.com/vitessio/vitess/pull/15679 we automatically strip any MySQL
auto_increment
clauses on tables that are being moved (using theMoveTables
command) from an unsharded keyspace to a sharded one. And since https://github.com/vitessio/vitess/pull/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_increment
clause if one does not already exist. This requires the use of two flags:--sharded-auto-increment-handling=replace
--global-keyspace
that 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-sequences
flag, which will create a missing sequence table when possibleManual test
Results:
The
strip_sharded_auto_increment
field 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 frombool
to anenum
/int32
to support the new REPLACE option. This is upgrade/downgrade safe because the wire format for bool is avarint
with 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
main
with avtctldclient
binary from the PR branch:So we can see that the auto_increment clauses were still removed.
Related Issue(s)
Checklist