Skip to content

Commit dd9a3e1

Browse files
author
Shlomi Noach
committed
adding PK, UK, PK-to-UK conversion tests
1 parent 36a66e0 commit dd9a3e1

8 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
i int not null,
5+
ts timestamp,
6+
primary key(id)
7+
) auto_increment=1;
8+
9+
drop event if exists gh_ost_test;
10+
delimiter ;;
11+
create event gh_ost_test
12+
on schedule every 1 second
13+
starts current_timestamp
14+
ends current_timestamp + interval 60 second
15+
on completion not preserve
16+
enable
17+
do
18+
begin
19+
insert into gh_ost_test values (null, 11, now());
20+
insert into gh_ost_test values (null, 13, now());
21+
insert into gh_ost_test values (null, 17, now());
22+
end ;;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No shared unique key can be found after ALTER
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="drop primary key, add primary key (id, i)"

localtests/swap-pk-uk/create.sql

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id bigint,
4+
i int not null,
5+
ts timestamp(6),
6+
primary key(id),
7+
unique key its_uidx(i, ts)
8+
) ;
9+
10+
drop event if exists gh_ost_test;
11+
delimiter ;;
12+
create event gh_ost_test
13+
on schedule every 1 second
14+
starts current_timestamp
15+
ends current_timestamp + interval 60 second
16+
on completion not preserve
17+
enable
18+
do
19+
begin
20+
insert into gh_ost_test values ((unix_timestamp() << 2) + 0, 11, now(6));
21+
insert into gh_ost_test values ((unix_timestamp() << 2) + 1, 13, now(6));
22+
insert into gh_ost_test values ((unix_timestamp() << 2) + 2, 17, now(6));
23+
insert into gh_ost_test values ((unix_timestamp() << 2) + 3, 19, now(6));
24+
end ;;

localtests/swap-pk-uk/extra_args

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="drop primary key, drop key its_uidx, add primary key (i, ts), add unique key id_uidx(id)"

localtests/swap-pk-uk/order_by

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id

localtests/swap-uk/create.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
i int not null,
5+
ts timestamp,
6+
primary key(id)
7+
) auto_increment=1;
8+
9+
drop event if exists gh_ost_test;
10+
delimiter ;;
11+
create event gh_ost_test
12+
on schedule every 1 second
13+
starts current_timestamp
14+
ends current_timestamp + interval 60 second
15+
on completion not preserve
16+
enable
17+
do
18+
begin
19+
insert into gh_ost_test values (null, 11, now());
20+
insert into gh_ost_test values (null, 13, now());
21+
insert into gh_ost_test values (null, 17, now());
22+
end ;;

localtests/swap-uk/extra_args

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="drop primary key, add unique key(id)"

0 commit comments

Comments
 (0)