Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ jobs:
sudo apt-get install -y lsb-release gnupg2 curl
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps80
# Enable tools repository first, then ps-80
sudo percona-release enable-only tools release
sudo percona-release enable ps-80 release
sudo apt-get update

# Install everything else we need, and configure
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cluster_endtoend_xb_backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ jobs:
sudo apt-get install -y lsb-release gnupg2 curl
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps80
# Enable tools repository first, then ps-80
sudo percona-release enable-only tools release
sudo percona-release enable ps-80 release
sudo apt-get update

# Install everything else we need, and configure
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cluster_endtoend_xb_recovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ jobs:
sudo apt-get install -y lsb-release gnupg2 curl
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps80
# Enable tools repository first, then ps-80
sudo percona-release enable-only tools release
sudo percona-release enable ps-80 release
sudo apt-get update

# Install everything else we need, and configure
Expand Down
16 changes: 8 additions & 8 deletions go/test/endtoend/vtgate/queries/dml/dml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,40 +88,40 @@ func TestDeleteWithLimit(t *testing.T) {
defer closer()

// initial rows
mcmp.Exec("insert into s_tbl(id, num) values (1,10), (2,10), (3,10), (4,20), (5,5), (6,15), (7,17), (8,80)")
mcmp.Exec("insert into s_tbl(id, col) values (1,10), (2,10), (3,10), (4,20), (5,5), (6,15), (7,17), (8,80)")
mcmp.Exec("insert into order_tbl(region_id, oid, cust_no) values (1,1,4), (1,2,2), (2,3,5), (2,4,55)")

// check rows
mcmp.AssertMatches(`select id, num from s_tbl order by id`,
mcmp.AssertMatches(`select id, col from s_tbl order by id`,
`[[INT64(1) INT64(10)] [INT64(2) INT64(10)] [INT64(3) INT64(10)] [INT64(4) INT64(20)] [INT64(5) INT64(5)] [INT64(6) INT64(15)] [INT64(7) INT64(17)] [INT64(8) INT64(80)]]`)
mcmp.AssertMatches(`select region_id, oid, cust_no from order_tbl order by oid`,
`[[INT64(1) INT64(1) INT64(4)] [INT64(1) INT64(2) INT64(2)] [INT64(2) INT64(3) INT64(5)] [INT64(2) INT64(4) INT64(55)]]`)

// delete with limit
qr := mcmp.Exec(`delete from s_tbl order by num, id limit 3`)
qr := mcmp.Exec(`delete from s_tbl order by col, id limit 3`)
require.EqualValues(t, 3, qr.RowsAffected)

qr = mcmp.Exec(`delete from order_tbl where region_id = 1 limit 1`)
require.EqualValues(t, 1, qr.RowsAffected)

// check rows
mcmp.AssertMatches(`select id, num from s_tbl order by id`,
mcmp.AssertMatches(`select id, col from s_tbl order by id`,
`[[INT64(3) INT64(10)] [INT64(4) INT64(20)] [INT64(6) INT64(15)] [INT64(7) INT64(17)] [INT64(8) INT64(80)]]`)
// 2 rows matches but limit is 1, so any one of the row can remain in table.
mcmp.AssertMatchesAnyNoCompare(`select region_id, oid, cust_no from order_tbl order by oid`,
`[[INT64(1) INT64(2) INT64(2)] [INT64(2) INT64(3) INT64(5)] [INT64(2) INT64(4) INT64(55)]]`,
`[[INT64(1) INT64(1) INT64(4)] [INT64(2) INT64(3) INT64(5)] [INT64(2) INT64(4) INT64(55)]]`)

// delete with limit
qr = mcmp.Exec(`delete from s_tbl where num < 20 limit 2`)
qr = mcmp.Exec(`delete from s_tbl where col < 20 limit 2`)
require.EqualValues(t, 2, qr.RowsAffected)

qr = mcmp.Exec(`delete from order_tbl limit 5`)
require.EqualValues(t, 3, qr.RowsAffected)

// check rows
// 3 rows matches `num < 20` but limit is 2 so any one of them can remain in the table.
mcmp.AssertMatchesAnyNoCompare(`select id, num from s_tbl order by id`,
// 3 rows matches `col < 20` but limit is 2 so any one of them can remain in the table.
mcmp.AssertMatchesAnyNoCompare(`select id, col from s_tbl order by id`,
`[[INT64(4) INT64(20)] [INT64(7) INT64(17)] [INT64(8) INT64(80)]]`,
`[[INT64(3) INT64(10)] [INT64(4) INT64(20)] [INT64(8) INT64(80)]]`,
`[[INT64(4) INT64(20)] [INT64(6) INT64(15)] [INT64(8) INT64(80)]]`)
Expand All @@ -133,7 +133,7 @@ func TestDeleteWithLimit(t *testing.T) {
mcmp.Exec(`delete from order_tbl limit 5`)

// try with limit again on empty table.
qr = mcmp.Exec(`delete from s_tbl where num < 20 limit 2`)
qr = mcmp.Exec(`delete from s_tbl where col < 20 limit 2`)
require.EqualValues(t, 0, qr.RowsAffected)

qr = mcmp.Exec(`delete from order_tbl limit 5`)
Expand Down
2 changes: 1 addition & 1 deletion go/test/endtoend/vtgate/queries/dml/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func start(t *testing.T) (utils.MySQLCompare, func()) {
_, _ = utils.ExecAllowError(t, mcmp.VtConn, "set workload = oltp")

tables := []string{
"s_tbl", "num_vdx_tbl", "user_tbl", "order_tbl", "oevent_tbl", "oextra_tbl",
"s_tbl", "num_vdx_tbl", "col_vdx_tbl", "user_tbl", "order_tbl", "oevent_tbl", "oextra_tbl",
"auto_tbl", "oid_vdx_tbl", "unq_idx", "nonunq_idx", "u_tbl", "mixed_tbl", "lkp_map_idx", "j_tbl", "j_utbl",
}
for _, table := range tables {
Expand Down
10 changes: 10 additions & 0 deletions go/test/endtoend/vtgate/queries/dml/sharded_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ create table s_tbl
(
id bigint,
num bigint,
col bigint,
unique key (num),
primary key (id)
) Engine = InnoDB;

Expand All @@ -12,6 +14,14 @@ create table num_vdx_tbl
primary key (num)
) Engine = InnoDB;

create table col_vdx_tbl
(
col bigint,
id bigint,
keyspace_id varbinary(20),
primary key (col, id)
) Engine = InnoDB;

create table user_tbl
(
id bigint,
Expand Down
25 changes: 24 additions & 1 deletion go/test/endtoend/vtgate/queries/dml/vschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
"params": {
"table": "num_vdx_tbl",
"from": "num",
"to": "keyspace_id"
"to": "keyspace_id",
"ignore_nulls": "true"
},
"owner": "s_tbl"
},
"col_vdx": {
"type": "consistent_lookup",
"params": {
"table": "col_vdx_tbl",
"from": "col,id",
"to": "keyspace_id",
"ignore_nulls": "true"
},
"owner": "s_tbl"
},
Expand Down Expand Up @@ -63,6 +74,10 @@
{
"column": "num",
"name": "num_vdx"
},
{
"columns": ["col", "id"],
"name": "col_vdx"
}
]
},
Expand All @@ -74,6 +89,14 @@
}
]
},
"col_vdx_tbl": {
"column_vindexes": [
{
"column": "col",
"name": "hash"
}
]
},
"user_tbl": {
"auto_increment": {
"column": "id",
Expand Down
4 changes: 3 additions & 1 deletion test/templates/cluster_endtoend_test.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ jobs:
sudo apt-get install -y lsb-release gnupg2 curl
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release setup ps80
# Enable tools repository first, then ps-80
sudo percona-release enable-only tools release
sudo percona-release enable ps-80 release
sudo apt-get update

# Install everything else we need, and configure
Expand Down
Loading