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

MoveTables: update vschema while moving tables with autoincrement from sharded to unsharded #9288

Merged

Conversation

rohit-nayak-ps
Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps commented Nov 26, 2021

Description

When a sharded table with autoincrement is moved using MoveTables to an unsharded keyspace, currently the related sequence information is not carried over into the target (unsharded) keyspace's vschema.

This PR fixes that by copying over the sequence info from the source schema for that table. This is verified by adding this use-case to the v2 end-to-end test.

Signed-off-by: Rohit Nayak rohit@planetscale.com

Related Issue(s)

#9002

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

… to unsharded keyspace

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@rohit-nayak-ps rohit-nayak-ps marked this pull request as ready for review November 26, 2021 15:39
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a nit about test flakiness and a couple of questions but nothing blocking IMO. Thanks!

Copy link
Member

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matt's review looks good. You may merge once it is addressed.

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Copy link
Contributor

@mattlord mattlord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I had two minor nits/questions, but you can ignore them. Thanks!

done = true
log.Infof("Workflow %s has started", ksWorkflow)
}
case <-time.After(5 * time.Second):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, any reason to have the timeout this low? We risk causing the entire action/test to fail. I'm not sure more time is really needed, just curious. We could also make the wait time a parameter.

Feel free to ignore.

}
output, err := vc.VtctlClient.ExecuteCommandWithOutput("Workflow", ksWorkflow, "show")
require.NoError(t, err)
if strings.Contains(output, "\"State\": \"Running\"") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, maybe better to use a RegEx or JSON parsing so that we are checking for what we really care about while resilient to whitespace and other minor format changes? Full JSON parsing is probably overkill, maybe RegEx is too :-)

Feel free to ignore.

@rohit-nayak-ps rohit-nayak-ps marked this pull request as draft December 9, 2021 09:30
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@rohit-nayak-ps rohit-nayak-ps marked this pull request as ready for review December 9, 2021 15:35
@rohit-nayak-ps rohit-nayak-ps merged commit e99d337 into vitessio:main Dec 15, 2021
@rohit-nayak-ps rohit-nayak-ps deleted the rn-movetables-vschema-sequence branch December 15, 2021 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants