Skip to content
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

Bug Report: escaping backticks issue when doing MoveTables SwitchTraffic --initalize-target-sequences #17183

Closed
mcrauwel opened this issue Nov 8, 2024 · 1 comment

Comments

@mcrauwel
Copy link
Contributor

mcrauwel commented Nov 8, 2024

Overview of the Issue

we hit one little snag at the initial attempt:

E1108 11:40:09.681615   67580 main.go:56] rpc error: code = Unknown desc = failed to initialize the sequences used in the sharded keyspace: failed to initialize the backing sequence table unsharded.`table1_seq`: rpc error: code = Unknown desc = TabletManager.ExecuteFetchAsApp on aws_useast1b_1-0908619059 error: rpc error: code = Unknown desc = Table 'unsharded.`table1_seq`' doesn't exist (errno 1146) (sqlstate 42S02) during query: insert into `unsharded`.```table1_seq``` (id, next_id, cache) values (0, 12345, 1000) on duplicate key update next_id = if(next_id < 12345, 12345, next_id): rpc error: code = Unknown desc = Table 'unsharded.`table1_seq`' doesn't exist (errno 1146) (sqlstate 42S02) during query: insert into `unsharded`.```table1_seq``` (id, next_id, cache) values (0, 12345, 1000) on duplicate key update next_id = if(next_id < 12345, 12345, next_id)

the sequence definitions were like this on the sharded vschema

      "auto_increment": {
        "column": "id",
        "sequence": "`unsharded`.`table1_seq`"
      },

that validated fine, vitess seemed to be able to deal with ` around the keyspace name but not with the ones on the table name.
I then updated all the auto_increment definitions to this:

      "auto_increment": {
        "column": "id",
        "sequence": "unsharded.table1_seq"
      },

Reproduction Steps

vschema snippet

      "auto_increment": {
        "column": "id",
        "sequence": "`unsharded`.`table1_seq`"
      },

command being executed

vtctldclient --server :15999 MoveTables --target-keyspace sharded --workflow reshard switchtraffic --initialize-target-sequences --tablet-types PRIMARY

Binary Version

# vttablet -- /vt/bin/vttablet --version
vttablet version Version: 18.0.0-SNAPSHOT (Git revision 261c57ce4513f74a9d45188015c228aee947d228 branch 'latest-18.0') built on Tue Oct 22 05:04:46 UTC 2024 by vitess@buildkitsandbox using go1.21.13 linux/amd64

Operating System and Environment details

ID=wolfi
NAME="Wolfi"
PRETTY_NAME="Wolfi"
VERSION_ID="20230201"
HOME_URL="https://wolfi.dev"
BUG_REPORT_URL="https://github.com/wolfi-dev/os/issues"
Linux 5.15.0-1071-aws
x86_64


### Log Fragments

_No response_
@mcrauwel mcrauwel added Needs Triage This issue needs to be correctly labelled and triaged Type: Bug labels Nov 8, 2024
@mcrauwel mcrauwel changed the title Bug Report: escaping issue when doing MoveTables SwitchTraffic --initalize-target-sequences` Bug Report: escaping backticks issue when doing MoveTables SwitchTraffic --initalize-target-sequences Nov 8, 2024
@shlomi-noach shlomi-noach added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Backup and Restore Component: VReplication and removed Needs Triage This issue needs to be correctly labelled and triaged Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Backup and Restore labels Nov 8, 2024
@rohit-nayak-ps
Copy link
Contributor

This has been fixed in #16169.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants