@@ -628,7 +628,6 @@ func TestPlayerStatementModeWithFilterAndErrorHandling(t *testing.T) {
628
628
629
629
// It does not work when filter is enabled
630
630
output := qh .Expect (
631
- "begin" ,
632
631
"rollback" ,
633
632
fmt .Sprintf ("/update _vt.vreplication set message='%s" , expectedMsg ),
634
633
)
@@ -975,8 +974,7 @@ func TestPlayerFilters(t *testing.T) {
975
974
input : "insert into src4 values (1,100,'aaa'),(2,200,'bbb'),(3,100,'ccc')" ,
976
975
output : qh .Expect (
977
976
"begin" ,
978
- "insert into dst4(id1,val) values (1,_binary'aaa')" ,
979
- "insert into dst4(id1,val) values (3,_binary'ccc')" ,
977
+ "insert into dst4(id1,val) values (1,_binary'aaa'), (3,_binary'ccc')" ,
980
978
"/update _vt.vreplication set pos=" ,
981
979
"commit" ,
982
980
),
@@ -987,8 +985,7 @@ func TestPlayerFilters(t *testing.T) {
987
985
input : "insert into src5 values (1,100,'abc'),(2,200,'xyz'),(3,100,'xyz'),(4,300,'abc'),(5,200,'xyz')" ,
988
986
output : qh .Expect (
989
987
"begin" ,
990
- "insert into dst5(id1,val) values (1,_binary'abc')" ,
991
- "insert into dst5(id1,val) values (4,_binary'abc')" ,
988
+ "insert into dst5(id1,val) values (1,_binary'abc'), (4,_binary'abc')" ,
992
989
"/update _vt.vreplication set pos=" ,
993
990
"commit" ,
994
991
),
@@ -1495,17 +1492,15 @@ func TestPlayerRowMove(t *testing.T) {
1495
1492
})
1496
1493
expectDBClientQueries (t , qh .Expect (
1497
1494
"begin" ,
1498
- "insert into dst(val1,sval2,rcount) values (1,ifnull(1, 0),1) on duplicate key update sval2=sval2+ifnull(values(sval2), 0), rcount=rcount+1" ,
1499
- "insert into dst(val1,sval2,rcount) values (2,ifnull(2, 0),1) on duplicate key update sval2=sval2+ifnull(values(sval2), 0), rcount=rcount+1" ,
1500
- "insert into dst(val1,sval2,rcount) values (2,ifnull(3, 0),1) on duplicate key update sval2=sval2+ifnull(values(sval2), 0), rcount=rcount+1" ,
1495
+ "insert into dst(val1,sval2,rcount) values (1,ifnull(1, 0),1), (2,ifnull(2, 0),1), (2,ifnull(3, 0),1) on duplicate key update sval2=sval2+ifnull(values(sval2), 0), rcount=rcount+1" ,
1501
1496
"/update _vt.vreplication set pos=" ,
1502
1497
"commit" ,
1503
1498
))
1504
1499
expectData (t , "dst" , [][]string {
1505
1500
{"1" , "1" , "1" },
1506
1501
{"2" , "5" , "2" },
1507
1502
})
1508
- validateQueryCountStat (t , "replicate" , 3 )
1503
+ validateQueryCountStat (t , "replicate" , 1 )
1509
1504
1510
1505
execStatements (t , []string {
1511
1506
"update src set val1=1, val2=4 where id=3" ,
@@ -1521,7 +1516,7 @@ func TestPlayerRowMove(t *testing.T) {
1521
1516
{"1" , "5" , "2" },
1522
1517
{"2" , "2" , "1" },
1523
1518
})
1524
- validateQueryCountStat (t , "replicate" , 5 )
1519
+ validateQueryCountStat (t , "replicate" , 3 )
1525
1520
}
1526
1521
1527
1522
func TestPlayerTypes (t * testing.T ) {
@@ -1737,6 +1732,7 @@ func TestPlayerDDL(t *testing.T) {
1737
1732
pos1 := primaryPosition (t )
1738
1733
// The stop position must be the GTID of the first DDL
1739
1734
expectDBClientQueries (t , qh .Expect (
1735
+ "/update _vt.vreplication set state='Stopped'" ,
1740
1736
"begin" ,
1741
1737
fmt .Sprintf ("/update _vt.vreplication set pos='%s'" , pos1 ),
1742
1738
"/update _vt.vreplication set state='Stopped'" ,
@@ -1757,6 +1753,7 @@ func TestPlayerDDL(t *testing.T) {
1757
1753
// Second update is from vreplicator.
1758
1754
"/update _vt.vreplication set message='Picked source tablet.*" ,
1759
1755
"/update.*'Running'" ,
1756
+ "/update _vt.vreplication set state='Stopped'" ,
1760
1757
"begin" ,
1761
1758
fmt .Sprintf ("/update.*'%s'" , pos2 ),
1762
1759
"/update _vt.vreplication set state='Stopped'" ,
@@ -1922,6 +1919,7 @@ func TestPlayerStopPos(t *testing.T) {
1922
1919
// Second update is from vreplicator.
1923
1920
"/update _vt.vreplication set message='Picked source tablet.*" ,
1924
1921
"/update.*'Running'" ,
1922
+ "/update.*'Stopped'" ,
1925
1923
"begin" ,
1926
1924
"insert into yes(id,val) values (1,'aaa')" ,
1927
1925
fmt .Sprintf ("/update.*compress.*'%s'" , stopPos ),
@@ -1947,6 +1945,7 @@ func TestPlayerStopPos(t *testing.T) {
1947
1945
// Second update is from vreplicator.
1948
1946
"/update _vt.vreplication set message='Picked source tablet.*" ,
1949
1947
"/update.*'Running'" ,
1948
+ "/update.*'Stopped'" ,
1950
1949
"begin" ,
1951
1950
// Since 'no' generates empty transactions that are skipped by
1952
1951
// vplayer, a commit is done only for the stop position event.
@@ -2179,6 +2178,14 @@ func TestPlayerSplitTransaction(t *testing.T) {
2179
2178
func TestPlayerLockErrors (t * testing.T ) {
2180
2179
defer deleteTablet (addTablet (100 ))
2181
2180
2181
+ // The immediate retry behavior does not apply when doing
2182
+ // VPlayer Batching.
2183
+ origExperimentalFlags := vttablet .DefaultVReplicationConfig .ExperimentalFlags
2184
+ vttablet .DefaultVReplicationConfig .ExperimentalFlags = 0
2185
+ defer func () {
2186
+ vttablet .DefaultVReplicationConfig .ExperimentalFlags = origExperimentalFlags
2187
+ }()
2188
+
2182
2189
execStatements (t , []string {
2183
2190
"create table t1(id int, val varchar(128), primary key(id))" ,
2184
2191
fmt .Sprintf ("create table %s.t1(id int, val varchar(128), primary key(id))" , vrepldb ),
@@ -2258,6 +2265,14 @@ func TestPlayerLockErrors(t *testing.T) {
2258
2265
func TestPlayerCancelOnLock (t * testing.T ) {
2259
2266
defer deleteTablet (addTablet (100 ))
2260
2267
2268
+ // The immediate retry behavior does not apply when doing
2269
+ // VPlayer Batching.
2270
+ origExperimentalFlags := vttablet .DefaultVReplicationConfig .ExperimentalFlags
2271
+ vttablet .DefaultVReplicationConfig .ExperimentalFlags = 0
2272
+ defer func () {
2273
+ vttablet .DefaultVReplicationConfig .ExperimentalFlags = origExperimentalFlags
2274
+ }()
2275
+
2261
2276
execStatements (t , []string {
2262
2277
"create table t1(id int, val varchar(128), primary key(id))" ,
2263
2278
fmt .Sprintf ("create table %s.t1(id int, val varchar(128), primary key(id))" , vrepldb ),
0 commit comments