Skip to content

Bug Report: vtctldclient fails to apply routing rules  #16095

@mcrauwel

Description

@mcrauwel

Overview of the Issue

I am using ApplyRoutingRules --rules '<valid json>' to add routing rules to my Vitess cluster.

The vtctld response parses the correct number of routing rules but the fromTable and toTables reponses are empty:

Example

New RoutingRules object:
{
  "rules": [
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    }
  ]
}

Reproduction Steps

  1. Consider these routing rules JSON object:
{
    "rules": [
        {
            "fromTable": "sbtest1",
            "toTables": [
                "sbtest.sbtest1"
            ]
        },
        {
            "fromTable": "sbtest2",
            "toTables": [
                "sbtest.sbtest2"
            ]
        },
        {
            "fromTable": "sbtest3",
            "toTables": [
                "sbtest.sbtest3"
            ]
        },
        {
            "fromTable": "sbtest4",
            "toTables": [
                "sbtest.sbtest4"
            ]
        },
        {
            "fromTable": "sbtest5",
            "toTables": [
                "sbtest.sbtest5"
            ]
        },
        {
            "fromTable": "sbtest6",
            "toTables": [
                "sbtest.sbtest6"
            ]
        },
        {
            "fromTable": "sbtest7",
            "toTables": [
                "sbtest.sbtest7"
            ]
        },
        {
            "fromTable": "sbtest8",
            "toTables": [
                "sbtest.sbtest8"
            ]
        }
    ]
}
  1. Apply the routing rules using vtctldclient
$ vtctldclient --server :15999 ApplyRoutingRules --rules '{
>     "rules": [
>         {
>             "fromTable": "sbtest1",
>             "toTables": [
>                 "sbtest.sbtest1"
>             ]
>         },
>         {
>             "fromTable": "sbtest2",
>             "toTables": [
>                 "sbtest.sbtest2"
>             ]
>         },
>         {
>             "fromTable": "sbtest3",
>             "toTables": [
>                 "sbtest.sbtest3"
>             ]
>         },
>         {
>             "fromTable": "sbtest4",
>             "toTables": [
>                 "sbtest.sbtest4"
>             ]
>         },
>         {
>             "fromTable": "sbtest5",
>             "toTables": [
>                 "sbtest.sbtest5"
>             ]
>         },
>         {
>             "fromTable": "sbtest6",
>             "toTables": [
>                 "sbtest.sbtest6"
>             ]
>         },
>         {
>             "fromTable": "sbtest7",
>             "toTables": [
>                 "sbtest.sbtest7"
>             ]
>         },
>         {
>             "fromTable": "sbtest8",
>             "toTables": [
>                 "sbtest.sbtest8"
>             ]
>         }
>     ]
> }'
  1. check the respone
New RoutingRules object:
{
  "rules": [
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    },
    {
      "from_table": "",
      "to_tables": []
    }
  ]
}
If this is not what you expected, check the input data (as JSON parsing will skip unexpected fields).

Binary Version

$ vtctldclient --version
vtctldclient version Version: 18.0.5 (Git revision 4bd2e1c2f88cbff68f8b969a9ee6dad236713490 branch 'HEAD') built on Wed May  8 12:04:27 UTC 2024 by runner@fv-az1024-873 using go1.21.10 linux/amd64

Operating System and Environment details

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ uname -sr
Linux 5.15.0-1061-aws
$ uname -m
x86_64


### Log Fragments

_No response_

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions