Skip to content

Commit

Permalink
Disable batching by default; update unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Nov 30, 2023
1 parent 7075db9 commit b1b9e9d
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 69 deletions.
4 changes: 2 additions & 2 deletions go/vt/vttablet/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const (
)

var (
// Default flags. Enable vplayer batching by default for testing.
VReplicationExperimentalFlags = VReplicationExperimentalFlagOptimizeInserts | VReplicationExperimentalFlagAllowNoBlobBinlogRowImage | VReplicationExperimentalFlagVPlayerBatching
// Default flags.
VReplicationExperimentalFlags = VReplicationExperimentalFlagOptimizeInserts | VReplicationExperimentalFlagAllowNoBlobBinlogRowImage
VReplicationNetReadTimeout = 300
VReplicationNetWriteTimeout = 600
CopyPhaseDuration = 1 * time.Hour
Expand Down
108 changes: 41 additions & 67 deletions go/vt/vttablet/tabletmanager/vreplication/vplayer_flaky_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3107,7 +3107,7 @@ func TestPlayerNoBlob(t *testing.T) {
require.Equal(t, int64(4), stats.PartialQueryCount.Counts()["update"])
}

func TestPlayerBulkDelete(t *testing.T) {
func TestPlayerBulkStatements(t *testing.T) {
oldVreplicationExperimentalFlags := vttablet.VReplicationExperimentalFlags
vttablet.VReplicationExperimentalFlags = vttablet.VReplicationExperimentalFlagVPlayerBatching
defer func() {
Expand Down Expand Up @@ -3137,83 +3137,53 @@ func TestPlayerBulkDelete(t *testing.T) {
Filter: filter,
OnDdl: binlogdatapb.OnDDLAction_IGNORE,
}
cancel, vrId := startVReplication(t, bls, "")
_ = vrId
cancel, _ := startVReplication(t, bls, "")
defer cancel()

testcases := []struct {
input string
output string
table string
data [][]string
}{{
input: "insert into t1(id, val1) values (1, 'aaa')",
output: "insert into t1(id,val1) values (1,'aaa')",
table: "t1",
data: [][]string{
{"1", "aaa"},
},
}, {
input: "insert into t1(id, val1) values (2, 'bbb')",
output: "insert into t1(id,val1) values (2,'bbb')",
table: "t1",
data: [][]string{
{"1", "aaa"},
{"2", "bbb"},
},
}, {
input: "insert into t1(id, val1) values (3, 'ccc')",
output: "insert into t1(id,val1) values (3,'ccc')",
table: "t1",
data: [][]string{
{"1", "aaa"},
{"2", "bbb"},
{"3", "ccc"},
},
}, {
input: "insert into t1(id, val1) values (4, 'ddd')",
output: "insert into t1(id,val1) values (4,'ddd')",
table: "t1",
data: [][]string{
{"1", "aaa"},
{"2", "bbb"},
{"3", "ccc"},
{"4", "ddd"},
}{
{
input: "insert into t1(id, val1) values (1, 'aaa'), (2, 'bbb'), (3, 'ccc'), (4, 'ddd'), (5, 'eee')",
output: "insert into t1(id,val1) values (1,'aaa'), (2,'bbb'), (3,'ccc'), (4,'ddd'), (5,'eee')",
table: "t1",
data: [][]string{
{"1", "aaa"},
{"2", "bbb"},
{"3", "ccc"},
{"4", "ddd"},
{"5", "eee"},
},
},
}, {
input: "insert into t1(id, val1) values (5, 'eee')",
output: "insert into t1(id,val1) values (5,'eee')",
table: "t1",
data: [][]string{
{"1", "aaa"},
{"2", "bbb"},
{"3", "ccc"},
{"4", "ddd"},
{"5", "eee"},
{
input: "delete from t1 where id = 1",
output: "delete from t1 where id=1",
table: "t1",
data: [][]string{
{"2", "bbb"},
{"3", "ccc"},
{"4", "ddd"},
{"5", "eee"},
},
},
}, {
input: "delete from t1 where id = 1",
output: "delete from t1 where id=1",
table: "t1",
data: [][]string{
{"2", "bbb"},
{"3", "ccc"},
{"4", "ddd"},
{"5", "eee"},
{
input: "delete from t1 where id > 3",
output: "delete from t1 where id in (4, 5)",
table: "t1",
data: [][]string{
{"2", "bbb"},
{"3", "ccc"},
},
},
}, {
input: "delete from t1 where id > 3",
output: "delete from t1 where id in (4, 5)",
table: "t1",
data: [][]string{
{"2", "bbb"},
{"3", "ccc"},
{
input: "delete from t1",
output: "delete from t1 where id in (2, 3)",
table: "t1",
},
}, {
input: "delete from t1",
output: "delete from t1 where id in (2, 3)",
table: "t1",
}}
}

for _, tcases := range testcases {
execStatements(t, []string{tcases.input})
Expand All @@ -3227,6 +3197,10 @@ func TestPlayerBulkDelete(t *testing.T) {
}
}

func TestPlayerBulkTransactions(t *testing.T) {
// TODO
}

func expectJSON(t *testing.T, table string, values [][]string, id int, exec func(ctx context.Context, query string) (*sqltypes.Result, error)) {
t.Helper()

Expand Down

0 comments on commit b1b9e9d

Please sign in to comment.