-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional test column to admins for debugging if required. Misc …
…testing changes/comments. ExecWithRetry enhanced with a timeout instead of the backoff function for now. Need to see if this can stay or needs to be changed Signed-off-by: Rohit Nayak <[email protected]>
- Loading branch information
1 parent
6049a37
commit d076111
Showing
7 changed files
with
99 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,5 +51,5 @@ insert into reftable (id, val1) values (3, 'c') | |
insert into reftable (id, val1) values (4, 'd') | ||
insert into reftable (id, val1) values (5, 'e') | ||
|
||
insert into admins(team_id, email) values(1, '[email protected]') | ||
insert into admins(team_id, email) values(2, '[email protected]') | ||
insert into admins(team_id, email, val) values(1, '[email protected]', 'ibis-1') | ||
insert into admins(team_id, email, val) values(2, '[email protected]', 'ibis-2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,14 @@ package vreplication | |
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"vitess.io/vitess/go/test/endtoend/throttler" | ||
"vitess.io/vitess/go/vt/log" | ||
binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata" | ||
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata" | ||
vttablet "vitess.io/vitess/go/vt/vttablet/common" | ||
) | ||
|
||
|
@@ -29,20 +35,38 @@ func TestWorkflowDuplicateKeyBackoff(t *testing.T) { | |
_ = targetTabs | ||
tables := "customer,admins" | ||
|
||
req := &vtctldatapb.UpdateThrottlerConfigRequest{ | ||
Enable: false, | ||
} | ||
res, err := throttler.UpdateThrottlerTopoConfigRaw(vc.VtctldClient, "customer", req, nil, nil) | ||
require.NoError(t, err, res) | ||
res, err = throttler.UpdateThrottlerTopoConfigRaw(vc.VtctldClient, "product", req, nil, nil) | ||
require.NoError(t, err, res) | ||
|
||
mt := createMoveTables(t, sourceKeyspaceName, targetKeyspaceName, workflowName, tables, nil, nil, nil) | ||
waitForWorkflowState(t, vc, "customer.wf1", binlogdatapb.VReplicationWorkflowState_Running.String()) | ||
mt.SwitchReadsAndWrites() | ||
vtgateConn, cancel := getVTGateConn() | ||
defer cancel() | ||
|
||
// team_id 1 => 80-, team_id 2 => -80 | ||
queries := []string{ | ||
"update admins set email = null where team_id = 2", | ||
"update admins set email = '[email protected]' where team_id = 1", | ||
"update admins set email = '[email protected]' where team_id = 2", | ||
"update admins set email = null, val = 'ibis-3' where team_id = 2", // -80 | ||
"update admins set email = '[email protected]', val = 'ibis-4' where team_id = 1", // 80- | ||
"update admins set email = '[email protected]', val = 'ibis-5' where team_id = 2", // -80 | ||
} | ||
|
||
vc.VtctlClient.ExecuteCommandWithOutput("VReplicationExec", "zone1-100", "update _vt.vreplication set state = 'Stopped' where id = 2") | ||
vc.VtctlClient.ExecuteCommandWithOutput("VReplicationExec", "zone1-100", "update _vt.vreplication set state = 'Stopped' where id = 1") //-80 | ||
for _, query := range queries { | ||
execVtgateQuery(t, vtgateConn, targetKeyspaceName, query) | ||
} | ||
|
||
// Since -80 is stopped the "update admins set email = '[email protected]' where team_id = 1" will fail with duplicate key | ||
// since it is already set for team_id = 2 | ||
// The vplayer stream for -80 should backoff with the new logic and retry should be successful once the -80 stream is restarted | ||
time.Sleep(5 * time.Second) | ||
vc.VtctlClient.ExecuteCommandWithOutput("VReplicationExec", "zone1-100", "update _vt.vreplication set state = 'Running' where id = 1") | ||
productTab := vc.Cells["zone1"].Keyspaces[sourceKeyspaceName].Shards["0"].Tablets["zone1-100"].Vttablet | ||
waitForResult(t, productTab, "product", "select * from admins order by team_id", | ||
"[[INT32(1) VARCHAR(\"[email protected]\") VARCHAR(\"ibis-4\")] [INT32(2) VARCHAR(\"[email protected]\") VARCHAR(\"ibis-5\")]]", 20*time.Second) | ||
log.Infof("TestWorkflowDuplicateKeyBackoff passed") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters