-
Couldn't load subscription status.
- Fork 2.3k
Experimental: Multi-tenant import support in Vitess #15503
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
Changes from all commits
1b8029f
4ee9820
07a795e
aa959db
f5b5a9b
8d0f27c
a619db6
d58dcb4
20f22ea
b30edf0
8000c5b
10b811c
4f7e07d
890a6a9
7960093
097e900
931f9b6
2a357bb
9036db2
ce4e897
1fd7766
a2fb454
78cdbc6
670ef6d
d42d6f9
4f599c4
f4d78e0
b2c6e1c
6b18d92
1aec51c
c4066e9
1248a1d
b680c4b
e698083
863ab46
4a4c48d
59521fd
562b61e
f54b2a9
4123421
d154b66
a18387e
f70f7eb
2eb44e6
7850fea
6758d01
077a5fa
a437a7f
082d6d4
94b0291
38d34e9
36027f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| # DO NOT MODIFY: THIS FILE IS GENERATED USING "make generate_ci_workflows" | ||
|
|
||
| name: Cluster (vreplication_multi_tenant) | ||
| on: [push, pull_request] | ||
| concurrency: | ||
| group: format('{0}-{1}', ${{ github.ref }}, 'Cluster (vreplication_multi_tenant)') | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: read-all | ||
|
|
||
| env: | ||
| LAUNCHABLE_ORGANIZATION: "vitess" | ||
| LAUNCHABLE_WORKSPACE: "vitess-app" | ||
| GITHUB_PR_HEAD_SHA: "${{ github.event.pull_request.head.sha }}" | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Run endtoend tests on Cluster (vreplication_multi_tenant) | ||
| runs-on: gh-hosted-runners-4cores-1 | ||
|
|
||
| steps: | ||
| - name: Skip CI | ||
| run: | | ||
| if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then | ||
| echo "skipping CI due to the 'Skip CI' label" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check if workflow needs to be skipped | ||
| id: skip-workflow | ||
| run: | | ||
| skip='false' | ||
| if [[ "${{github.event.pull_request}}" == "" ]] && [[ "${{github.ref}}" != "refs/heads/main" ]] && [[ ! "${{github.ref}}" =~ ^refs/heads/release-[0-9]+\.[0-9]$ ]] && [[ ! "${{github.ref}}" =~ "refs/tags/.*" ]]; then | ||
| skip='true' | ||
| fi | ||
| echo Skip ${skip} | ||
| echo "skip-workflow=${skip}" >> $GITHUB_OUTPUT | ||
|
|
||
| PR_DATA=$(curl -s\ | ||
| -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
| -H "Accept: application/vnd.github.v3+json" \ | ||
| "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}") | ||
| draft=$(echo "$PR_DATA" | jq .draft -r) | ||
| echo "is_draft=${draft}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Check out code | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Check for changes in relevant files | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' | ||
| uses: dorny/[email protected] | ||
| id: changes | ||
| with: | ||
| token: '' | ||
| filters: | | ||
| end_to_end: | ||
| - 'go/**/*.go' | ||
| - 'go/vt/sidecardb/**/*.sql' | ||
| - 'go/test/endtoend/onlineddl/vrepl_suite/**' | ||
| - 'test.go' | ||
| - 'Makefile' | ||
| - 'build.env' | ||
| - 'go.sum' | ||
| - 'go.mod' | ||
| - 'proto/*.proto' | ||
| - 'tools/**' | ||
| - 'config/**' | ||
| - 'bootstrap.sh' | ||
| - '.github/workflows/cluster_endtoend_vreplication_multi_tenant.yml' | ||
|
|
||
| - name: Set up Go | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: 1.22.1 | ||
|
|
||
| - name: Set up python | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
| uses: actions/setup-python@v5 | ||
|
|
||
| - name: Tune the OS | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
| run: | | ||
| # Limit local port range to not use ports that overlap with server side | ||
| # ports that we listen on. | ||
| sudo sysctl -w net.ipv4.ip_local_port_range="22768 65535" | ||
| # Increase the asynchronous non-blocking I/O. More information at https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_use_native_aio | ||
| echo "fs.aio-max-nr = 1048576" | sudo tee -a /etc/sysctl.conf | ||
| sudo sysctl -p /etc/sysctl.conf | ||
|
|
||
| - name: Get dependencies | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
| run: | | ||
|
|
||
| # Get key to latest MySQL repo | ||
| sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A8D3785C | ||
| # Setup MySQL 8.0 | ||
| wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb | ||
| echo mysql-apt-config mysql-apt-config/select-server select mysql-8.0 | sudo debconf-set-selections | ||
| sudo DEBIAN_FRONTEND="noninteractive" dpkg -i mysql-apt-config* | ||
| sudo apt-get -qq update | ||
| # Install everything else we need, and configure | ||
| sudo apt-get -qq install -y mysql-server mysql-client make unzip g++ etcd curl git wget eatmydata xz-utils libncurses5 | ||
|
|
||
| sudo service mysql stop | ||
| sudo service etcd stop | ||
| sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ | ||
| sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld | ||
| go mod download | ||
|
|
||
| # install JUnit report formatter | ||
| go install github.com/vitessio/go-junit-report@HEAD | ||
|
|
||
| - name: Setup launchable dependencies | ||
| if: steps.skip-workflow.outputs.is_draft == 'false' && steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && github.base_ref == 'main' | ||
| run: | | ||
| # Get Launchable CLI installed. If you can, make it a part of the builder image to speed things up | ||
| pip3 install --user launchable~=1.0 > /dev/null | ||
|
|
||
| # verify that launchable setup is all correct. | ||
| launchable verify || true | ||
|
|
||
| # Tell Launchable about the build you are producing and testing | ||
| launchable record build --name "$GITHUB_RUN_ID" --no-commit-collection --source . | ||
|
|
||
| - name: Run cluster endtoend test | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' | ||
| timeout-minutes: 45 | ||
| run: | | ||
| # We set the VTDATAROOT to the /tmp folder to reduce the file path of mysql.sock file | ||
| # which musn't be more than 107 characters long. | ||
| export VTDATAROOT="/tmp/" | ||
| source build.env | ||
|
|
||
| set -exo pipefail | ||
|
|
||
| # Increase our open file descriptor limit as we could hit this | ||
| ulimit -n 65536 | ||
| cat <<-EOF>>./config/mycnf/mysql80.cnf | ||
| innodb_buffer_pool_dump_at_shutdown=OFF | ||
| innodb_buffer_pool_in_core_file=OFF | ||
| innodb_buffer_pool_load_at_startup=OFF | ||
| innodb_buffer_pool_size=64M | ||
| innodb_doublewrite=OFF | ||
| innodb_flush_log_at_trx_commit=0 | ||
| innodb_flush_method=O_DIRECT | ||
| innodb_numa_interleave=ON | ||
| innodb_adaptive_hash_index=OFF | ||
| sync_binlog=0 | ||
| sync_relay_log=0 | ||
| performance_schema=OFF | ||
| slow-query-log=OFF | ||
| EOF | ||
|
|
||
| cat <<-EOF>>./config/mycnf/mysql80.cnf | ||
| binlog-transaction-compression=ON | ||
| EOF | ||
|
|
||
| # run the tests however you normally do, then produce a JUnit XML file | ||
| eatmydata -- go run test.go -docker=false -follow -shard vreplication_multi_tenant | tee -a output.txt | go-junit-report -set-exit-code > report.xml | ||
|
|
||
| - name: Print test output and Record test result in launchable if PR is not a draft | ||
| if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always() | ||
| run: | | ||
| if [[ "${{steps.skip-workflow.outputs.is_draft}}" == "false" ]]; then | ||
| # send recorded tests to launchable | ||
| launchable record tests --build "$GITHUB_RUN_ID" go-test . || true | ||
| fi | ||
|
|
||
| # print test output | ||
| cat output.txt | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,3 +86,6 @@ report | |
|
|
||
| # plan test output | ||
| /go/vt/vtgate/planbuilder/testdata/plan_test* | ||
|
|
||
| # mise files | ||
| .mise.toml | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,156 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2024 The Vitess Authors. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "errors" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "fmt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "os" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "strings" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "github.com/spf13/cobra" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "vitess.io/vitess/go/cmd/vtctldclient/cli" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "vitess.io/vitess/go/json2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vschemapb "vitess.io/vitess/go/vt/proto/vschema" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // ApplyKeyspaceRoutingRules makes an ApplyKeyspaceRoutingRules gRPC call to a vtctld. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules = &cobra.Command{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Use: "ApplyKeyspaceRoutingRules {--rules RULES | --rules-file RULES_FILE} [--cells=c1,c2,...] [--skip-rebuild] [--dry-run]", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Short: "Applies the provided keyspace routing rules.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DisableFlagsInUseLine: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: cobra.NoArgs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PreRunE: validateApplyKeyspaceRoutingRulesOptions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RunE: commandApplyKeyspaceRoutingRules, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // GetKeyspaceRoutingRules makes a GetKeyspaceRoutingRules gRPC call to a vtctld. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GetKeyspaceRoutingRules = &cobra.Command{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Use: "GetKeyspaceRoutingRules", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Short: "Displays the currently active keyspace routing rules.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DisableFlagsInUseLine: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Args: cobra.NoArgs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RunE: commandGetKeyspaceRoutingRules, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func validateApplyKeyspaceRoutingRulesOptions(cmd *cobra.Command, args []string) error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| opts := applyKeyspaceRoutingRulesOptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (opts.Rules != "" && opts.RulesFilePath != "") || (opts.Rules == "" && opts.RulesFilePath == "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return errors.New("must pass exactly one of --rules or --rules-file") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var applyKeyspaceRoutingRulesOptions = struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Rules string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RulesFilePath string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Cells []string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SkipRebuild bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DryRun bool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func commandApplyKeyspaceRoutingRules(cmd *cobra.Command, args []string) error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| opts := applyKeyspaceRoutingRulesOptions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cli.FinishedParsing(cmd) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var rulesBytes []byte | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if opts.RulesFilePath != "" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data, err := os.ReadFile(opts.RulesFilePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rulesBytes = data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rulesBytes = []byte(opts.Rules) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| krr := &vschemapb.KeyspaceRoutingRules{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err := json2.Unmarshal(rulesBytes, &krr); err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Round-trip so that when we display the result it's readable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data, err := cli.MarshalJSON(krr) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if opts.DryRun { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Printf("[DRY RUN] Would have saved new KeyspaceRoutingRules object:\n%s\n", data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if opts.SkipRebuild { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Println("[DRY RUN] Would not have rebuilt VSchema graph, would have required operator to run RebuildVSchemaGraph for changes to take effect.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Print("[DRY RUN] Would have rebuilt the VSchema graph") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if len(opts.Cells) == 0 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Print(" in all cells\n") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Printf(" in the following cells: %s.\n", strings.Join(applyKeyspaceRoutingRulesOptions.Cells, ", ")) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, err = client.ApplyKeyspaceRoutingRules(commandCtx, &vtctldatapb.ApplyKeyspaceRoutingRulesRequest{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| KeyspaceRoutingRules: krr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SkipRebuild: opts.SkipRebuild, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RebuildCells: opts.Cells, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Printf("New KeyspaceRoutingRules object:\n%s\nIf this is not what you expected, check the input data (as JSON parsing will skip unexpected fields).\n", data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if opts.SkipRebuild { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Println("Skipping rebuild of VSchema graph as requested, you will need to run RebuildVSchemaGraph for the changes to take effect.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func commandGetKeyspaceRoutingRules(cmd *cobra.Command, args []string) error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cli.FinishedParsing(cmd) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resp, err := client.GetKeyspaceRoutingRules(commandCtx, &vtctldatapb.GetKeyspaceRoutingRulesRequest{}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data, err := cli.MarshalJSON(resp.KeyspaceRoutingRules) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fmt.Printf("%s\n", data) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func init() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules.Flags().StringVarP(&applyKeyspaceRoutingRulesOptions.Rules, "rules", "r", "", "Keyspace routing rules, specified as a string") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we mean a valid JSON document as a string or something else? This is where examples in the command definition can be helpful for the user. For example, see: vitess/go/cmd/vtctldclient/command/vreplication/materialize/create.go Lines 44 to 71 in fabd746
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules.Flags().StringVarP(&applyKeyspaceRoutingRulesOptions.RulesFilePath, "rules-file", "f", "", "Path to a file containing keyspace routing rules specified as JSON") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rohit-nayak-ps marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules.Flags().StringSliceVarP(&applyKeyspaceRoutingRulesOptions.Cells, "cells", "c", nil, "Limit the VSchema graph rebuilding to the specified cells. Ignored if --skip-rebuild is specified.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules.Flags().BoolVar(&applyKeyspaceRoutingRulesOptions.SkipRebuild, "skip-rebuild", false, "Skip rebuilding the SrvVSchema objects.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ApplyKeyspaceRoutingRules.Flags().BoolVarP(&applyKeyspaceRoutingRulesOptions.DryRun, "dry-run", "d", false, "Validate the specified keyspace routing rules and note actions that would be taken, but do not actually apply the rules to the topo.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Root.AddCommand(ApplyKeyspaceRoutingRules) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Root.AddCommand(GetKeyspaceRoutingRules) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.