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: Failed MoveTables Create still creates routing rules #13589

Closed
Anders-PlanetScale opened this issue Jul 21, 2023 · 1 comment · Fixed by #13737
Closed

Bug Report: Failed MoveTables Create still creates routing rules #13589

Anders-PlanetScale opened this issue Jul 21, 2023 · 1 comment · Fixed by #13737

Comments

@Anders-PlanetScale
Copy link
Collaborator

Overview of the Issue

Routing rules are created before a workflow is created and if the workflow is not created for some reason the routing rules are not cleaned up and left in place.

Reproduction Steps

  1. Create a two keyspace cluster with a keyspace1 and keyspace2, keyspace2 should be a 2 or more shard keyspace.

  2. Create two tables in keyspace1.

create table t1(id int NOT NULL auto_increment, primary key(id));
create table t2(id int NOT NULL auto_increment, primary key(id));
  1. Configure keyspace2 with the following vschema.
{
  "sharded": true,
  "vindexes": {
    "hash": {
      "type": "xxhash"
    }
  },
  "tables": {
    "t2": {
      "columnVindexes": [
        {
          "column": "id",
          "name": "hash"
        }
      ]
    }
  }
}

  1. Check that the existing RoutingRules are empty.

vtctlclient GetRoutingRules
5. Attempt to create a MoveTables workflow that moves t1 not t2 to keyspace2.

vtctlclient MoveTables -- --source keyspace1 --tables="t1" Create keyspace2.test

This should fail saying the table is not found in keyspace2's vschema.

  1. Check to see if the workflow was created, it should not have been.

vtctlclient workflow keyspace2 listall
7. Check the RoutingRules.

vtctlclient GetRoutingRules
8. You should now see routing rules in place for the MoveTables workflow that was not created.

Binary Version

This was tested on a v15 image, but I believe the behavior should be the same on v16 and v17.

`Version: 15.0.1-SNAPSHOT (Git revision cb465027e8811e9a4dbf4eb54b90cc1cf1dcc0ac branch 'main') built on Wed Jul  5 14:35:51 UTC 2023 by vitess@buildkitsandbox using go1.19.4 linux/amd64`

Operating System and Environment details

Debian GNU/Linux 10

Linux 5.15.0-1039-aws

x86_64

Log Fragments

No response

@Anders-PlanetScale Anders-PlanetScale added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged labels Jul 21, 2023
@mattlord
Copy link
Contributor

Confirmed on main with the following test case:

git checkout main && make build

pushd examples/local 

./101_initial_cluster.sh

for i in 200 201 202; do
        CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh
        SHARD=-80 CELL=zone1 KEYSPACE=commerce2 TABLET_UID=$i ../common/scripts/vttablet-up.sh
done
vtctldclient InitShardPrimary --force commerce2/-80 zone1-200

for i in 300 301 302; do
        CELL=zone1 TABLET_UID=$i ../common/scripts/mysqlctl-up.sh
        SHARD=80- CELL=zone1 KEYSPACE=commerce2 TABLET_UID=$i ../common/scripts/vttablet-up.sh
done
vtctldclient InitShardPrimary --force commerce2/80- zone1-300

vtctlclient ApplyVSchema -- --vschema='{"sharded":true,"vindexes":{"hash":{"type":"hash"}},"tables":{"corder":{"column_vindexes":[{"column":"customer_id","name":"hash"}]}}}' commerce2

vtctlclient GetRoutingRules 2>/dev/null

vtctlclient MoveTables -- --source commerce --tables 'customer,corder' Create commerce2.c2c2

vtctlclient GetRoutingRules 2>/dev/null

./401_teardown.sh
popd

@mattlord mattlord added Component: VReplication and removed Needs Triage This issue needs to be correctly labelled and triaged labels Jul 21, 2023
@mattlord mattlord self-assigned this Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants