Skip to content

Commit 3ee55f9

Browse files
shlomi-noachShlomi Noachtimvaillancourt
authored andcommitted
compound pk tests (#387)
* compound pk tests * more details in failure diff * more elaborate test; the pk-ts one consistently fails * Fix merge conflict Co-authored-by: Shlomi Noach <[email protected]> Co-authored-by: Tim Vaillancourt <[email protected]> Co-authored-by: Tim Vaillancourt <[email protected]>
1 parent acb0227 commit 3ee55f9

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

localtests/compound-pk-ts/create.sql

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
ts0 timestamp(6) default current_timestamp(6),
6+
updated tinyint unsigned default 0,
7+
primary key(id, ts0)
8+
) auto_increment=1;
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 (null, 11, sysdate(6), 0);
21+
update gh_ost_test set updated = 1 where i = 11 order by id desc limit 1;
22+
23+
insert into gh_ost_test values (null, 13, sysdate(6), 0);
24+
update gh_ost_test set updated = 1 where i = 13 order by id desc limit 1;
25+
26+
insert into gh_ost_test values (null, 17, sysdate(6), 0);
27+
update gh_ost_test set updated = 1 where i = 17 order by id desc limit 1;
28+
29+
insert into gh_ost_test values (null, 19, sysdate(6), 0);
30+
update gh_ost_test set updated = 1 where i = 19 order by id desc limit 1;
31+
32+
insert into gh_ost_test values (null, 23, sysdate(6), 0);
33+
update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1;
34+
35+
insert into gh_ost_test values (null, 29, sysdate(6), 0);
36+
insert into gh_ost_test values (null, 31, sysdate(6), 0);
37+
insert into gh_ost_test values (null, 37, sysdate(6), 0);
38+
insert into gh_ost_test values (null, 41, sysdate(6), 0);
39+
delete from gh_ost_test where i = 31 order by id desc limit 1;
40+
end ;;

localtests/compound-pk/create.sql

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
v varchar(128),
6+
updated tinyint unsigned default 0,
7+
primary key(id, v)
8+
) auto_increment=1;
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 (null, 11, 'eleven', 0);
21+
update gh_ost_test set updated = 1 where i = 11 order by id desc limit 1;
22+
23+
insert into gh_ost_test values (null, 13, 'thirteen', 0);
24+
update gh_ost_test set updated = 1 where i = 13 order by id desc limit 1;
25+
26+
insert into gh_ost_test values (null, 17, 'seventeen', 0);
27+
update gh_ost_test set updated = 1 where i = 17 order by id desc limit 1;
28+
29+
insert into gh_ost_test values (null, 19, 'nineteen', 0);
30+
update gh_ost_test set updated = 1 where i = 19 order by id desc limit 1;
31+
32+
insert into gh_ost_test values (null, 23, 'twenty three', 0);
33+
update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1;
34+
35+
insert into gh_ost_test values (null, 29, 'twenty nine', 0);
36+
insert into gh_ost_test values (null, 31, 'thirty one', 0);
37+
insert into gh_ost_test values (null, 37, 'thirty seven', 0);
38+
insert into gh_ost_test values (null, 41, 'forty one', 0);
39+
delete from gh_ost_test where i = 31 order by id desc limit 1;
40+
end ;;

localtests/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ test_single() {
224224
ghost_checksum=$(cat $ghost_content_output_file | md5sum)
225225

226226
if [ "$orig_checksum" != "$ghost_checksum" ] ; then
227+
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss > $orig_content_output_file
228+
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss > $ghost_content_output_file
227229
echo "ERROR $test_name: checksum mismatch"
228230
echo "---"
229231
diff $orig_content_output_file $ghost_content_output_file

0 commit comments

Comments
 (0)