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

For partial MoveTables, setup reverse shard routing rules on workflow creation #11415

Merged

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Oct 1, 2022

Description

For normal MoveTables operations — where you're moving tables from one keyspace to another, i.e. the move is at the keyspace level — global routing rules are put in place when the workflow is created so that any attempted access of those tables on the target keyspace are routed to the source keyspace. (In this scenario shard targeting is how you would explicitly get around this routing.)

For partial MoveTables operations, you're moving the tables from one keyspace to another one shard at a time — so the move is per shard rather than per keyspace. In this scenario you want all traffic to go to one side or the other for a given shard, including shard targeted queries. This then offers the same kind of "global" (scoped to a shard) routing at the shard level that you would expect when doing keyspace level MoveTables. This PR implements that functionality.

Note
We have NO documentation on partial MoveTables today (not even the relevant vttablet and vtgate flags). Should I create a new page in the docs here, or continue to defer that part?
Answer: YES. See: vitessio/website#1160

Related Issue(s)

Checklist

mattlord and others added 5 commits September 29, 2022 23:36
Signed-off-by: Matt Lord <[email protected]>
…les. Enhance e2e test to test for this as well as switch the remaining shard so that all shards are switched

Signed-off-by: Rohit Nayak <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VReplication labels Oct 1, 2022
@vitess-bot
Copy link
Contributor

vitess-bot bot commented Oct 1, 2022

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • If this is a change that users need to know about, please apply the release notes (needs details) label so that merging is blocked unless the summary release notes document is included.

If a new flag is being introduced:

  • Is it really necessary to add this flag?
  • Flag names should be clear and intuitive (as far as possible)
  • Help text should be descriptive.
  • Flag names should use dashes (-) as word separators rather than underscores (_).

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow should be required, the maintainer team should be notified.

Bug fixes

  • There should be at least one unit or end-to-end test.
  • The Pull Request description should include a link to an issue that describes the bug.

Non-trivial changes

  • There should be some code comments as to why things are implemented the way they are.

New/Existing features

  • Should be documented, either by modifying the existing documentation or creating new documentation.
  • New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • vtctl command output order should be stable and awk-able.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from VTop, if used there.

@mattlord mattlord marked this pull request as ready for review October 1, 2022 07:58
@mattlord mattlord requested review from aquarapid and removed request for deepthi October 1, 2022 07:58
@mattlord mattlord changed the title For partial MoveTables, setup reverse shard routing rules on first workflow creation For partial MoveTables, setup reverse shard routing rules on workflow creation Oct 2, 2022
@deepthi
Copy link
Member

deepthi commented Oct 3, 2022

We have NO documentation on partial MoveTables today (not even the relevant vttablet and vtgate flags). Should I create a new page in the docs here, or continue to defer that part?

I think we should document it. @rohit-nayak-ps thoughts?

@rohit-nayak-ps
Copy link
Contributor

I think we should document it. @rohit-nayak-ps thoughts?

Yes, that is the plan. We will have a link from MoveTables to a separate page highlighting the use cases, shard routing rules and their effect, limitations (need to disable schema tracking, for example) and the fact that it is experimental. Should be ready this week.

Copy link
Contributor

@rohit-nayak-ps rohit-nayak-ps left a comment

Choose a reason for hiding this comment

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

lgtm

@mattlord
Copy link
Contributor Author

mattlord commented Oct 4, 2022

Please note that this will be merged (and backported to release-15.0) just after the v15 RC1 release so that:

  1. We don't interfere with that timely release
  2. We have a feature complete shard level migration feature in 15.0 (see docs here: Document shard level migrations feature website#1160)

mattlord added a commit that referenced this pull request Oct 6, 2022
… creation (#11415) (#11447)

* Testing....

Signed-off-by: Matt Lord <[email protected]>

* Setup reverse routing rules at the start of the first partial movetables. Enhance e2e test to test for this as well as switch the remaining shard so that all shards are switched

Signed-off-by: Rohit Nayak <[email protected]>

* Update display representation of state for partially moved keyspaces

Signed-off-by: Rohit Nayak <[email protected]>

* Test improvements

Signed-off-by: Matt Lord <[email protected]>

* Cleanup shard routing rules on cancel/complete

Signed-off-by: Matt Lord <[email protected]>

* Cleanup intermediate changes

Signed-off-by: Matt Lord <[email protected]>

* Fix DryRun TrafficSwitcher and its tests

Signed-off-by: Matt Lord <[email protected]>

* Support concurrent partial movetables for N keyspaces

And other minor changes after self review

Signed-off-by: Matt Lord <[email protected]>

* Avoid unnecessary save + rebuild steps

Signed-off-by: Matt Lord <[email protected]>

* Add secondary ordering for shard routing rules on to_keyspace

Signed-off-by: Matt Lord <[email protected]>

* Minor changes after self review

Signed-off-by: Matt Lord <[email protected]>

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Co-authored-by: Rohit Nayak <[email protected]>

Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Rohit Nayak <[email protected]>
Co-authored-by: Rohit Nayak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VReplication Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants