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

[release-16.0] VReplication: Pass on --keep_routing_rules flag value for Cancel action (#13171) #13194

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion go/test/endtoend/vreplication/vreplication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tidwall/gjson"

"github.com/buger/jsonparser"

Expand Down Expand Up @@ -173,7 +174,19 @@ func TestVReplicationDDLHandling(t *testing.T) {
waitForQueryResult(t, vtgateConn, targetKs, checkColQueryTarget, "[[INT64(0)]]")
// Confirm new col does exist on source
waitForQueryResult(t, vtgateConn, sourceKs, checkColQuerySource, "[[INT64(1)]]")
moveTablesAction(t, "Cancel", defaultCellName, workflow, sourceKs, targetKs, table)
// Also test Cancel --keep_routing_rules
moveTablesAction(t, "Cancel", defaultCellName, workflow, sourceKs, targetKs, table, "--keep_routing_rules")
// Confirm that the routing rules were NOT cleared
rr, err := vc.VtctldClient.ExecuteCommandWithOutput("GetRoutingRules")
require.NoError(t, err)
require.Greater(t, len(gjson.Get(rr, "rules").Array()), 0)
// Manually clear the routing rules
err = vc.VtctldClient.ExecuteCommand("ApplyRoutingRules", "--rules", "{}")
require.NoError(t, err)
// Confirm that the routing rules are gone
rr, err = vc.VtctldClient.ExecuteCommandWithOutput("GetRoutingRules")
require.NoError(t, err)
require.Equal(t, len(gjson.Get(rr, "rules").Array()), 0)
// Drop the column on source to start fresh again
_, err = vtgateConn.ExecuteFetch(dropColDDL, 1, false)
require.NoError(t, err, "error executing %q: %v", dropColDDL, err)
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtctl/vtctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,7 @@ func commandVRWorkflow(ctx context.Context, wr *wrangler.Wrangler, subFlags *pfl
vrwp.MaxAllowedTransactionLagSeconds = int64(math.Ceil(maxReplicationLagAllowed.Seconds()))
case vReplicationWorkflowActionCancel:
vrwp.KeepData = *keepData
vrwp.KeepRoutingRules = *keepRoutingRules
case vReplicationWorkflowActionComplete:
switch workflowType {
case wrangler.MoveTablesWorkflow:
Expand Down