From eba4e320c40a83230d31f9726676cc2e832fe5b9 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 26 Mar 2017 19:27:27 +0300 Subject: [PATCH 1/4] compound pk tests --- localtests/compound-pk-ts/create.sql | 40 ++++++++++++++++++++++++++++ localtests/compound-pk/create.sql | 34 +++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 localtests/compound-pk-ts/create.sql create mode 100644 localtests/compound-pk/create.sql diff --git a/localtests/compound-pk-ts/create.sql b/localtests/compound-pk-ts/create.sql new file mode 100644 index 000000000..e05d2ad13 --- /dev/null +++ b/localtests/compound-pk-ts/create.sql @@ -0,0 +1,40 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + ts0 timestamp(6) default current_timestamp(6), + updated tinyint unsigned default 0, + primary key(id, ts0) +) auto_increment=1; + +drop event if exists gh_ost_test; +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test values (null, 11, now(6), 0); + update gh_ost_test set updated = 1 where i = 11 order by id desc limit 1; + + insert into gh_ost_test values (null, 13, now(6), 0); + update gh_ost_test set updated = 1 where i = 13 order by id desc limit 1; + + insert into gh_ost_test values (null, 17, now(6), 0); + update gh_ost_test set updated = 1 where i = 17 order by id desc limit 1; + + insert into gh_ost_test values (null, 19, now(6), 0); + update gh_ost_test set updated = 1 where i = 19 order by id desc limit 1; + + insert into gh_ost_test values (null, 23, now(6), 0); + update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1; + + insert into gh_ost_test values (null, 29, now(6), 0); + insert into gh_ost_test values (null, 31, now(6), 0); + insert into gh_ost_test values (null, 37, now(6), 0); + insert into gh_ost_test values (null, 41, now(6), 0); + delete from gh_ost_test where i = 31 order by id desc limit 1; +end ;; diff --git a/localtests/compound-pk/create.sql b/localtests/compound-pk/create.sql new file mode 100644 index 000000000..d45a69c2a --- /dev/null +++ b/localtests/compound-pk/create.sql @@ -0,0 +1,34 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + v varchar(128), + updated tinyint unsigned default 0, + primary key(id, v) +) auto_increment=1; + +drop event if exists gh_ost_test; +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test values (null, 11, 'eleven', 0); + update gh_ost_test set updated = 1 where i = 11 order by id desc limit 1; + + insert into gh_ost_test values (null, 13, 'thirteen', 0); + update gh_ost_test set updated = 1 where i = 13 order by id desc limit 1; + + insert into gh_ost_test values (null, 17, 'seventeen', 0); + update gh_ost_test set updated = 1 where i = 17 order by id desc limit 1; + + insert into gh_ost_test values (null, 19, 'nineteen', 0); + update gh_ost_test set updated = 1 where i = 19 order by id desc limit 1; + + insert into gh_ost_test values (null, 23, 'twenty three', 0); + update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1; +end ;; From f6ca08f905e5cb35b186217f8548b00f048a16c4 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Sun, 26 Mar 2017 19:28:51 +0300 Subject: [PATCH 2/4] more details in failure diff --- localtests/test.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/localtests/test.sh b/localtests/test.sh index 8bbcf6f16..3d592e5e1 100755 --- a/localtests/test.sh +++ b/localtests/test.sh @@ -11,6 +11,8 @@ tests_path=$(dirname $0) test_logfile=/tmp/gh-ost-test.log ghost_binary=/tmp/gh-ost-test exec_command_file=/tmp/gh-ost-test.bash +orig_table_csv_file=/tmp/gh-ost-test.orig.csv +ghost_table_csv_file=/tmp/gh-ost-test.ghost.csv test_pattern="${1:-.}" @@ -137,11 +139,15 @@ test_single() { ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho ${order_by}" -ss | md5sum) if [ "$orig_checksum" != "$ghost_checksum" ] ; then + gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss > ${orig_table_csv_file} + gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss > ${ghost_table_csv_file} echo "ERROR $test_name: checksum mismatch" echo "---" - gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss + cat ${orig_table_csv_file} echo "---" - gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss + cat ${ghost_table_csv_file} + echo "---" + echo "diff ${orig_table_csv_file} ${ghost_table_csv_file}" return 1 fi } From 27365045f83f7e4076d1e65f25ff53c096ec5aa3 Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Mon, 27 Mar 2017 09:18:31 +0300 Subject: [PATCH 3/4] more elaborate test; the pk-ts one consistently fails --- localtests/compound-pk-ts/create.sql | 18 +++++++++--------- localtests/compound-pk/create.sql | 6 ++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/localtests/compound-pk-ts/create.sql b/localtests/compound-pk-ts/create.sql index e05d2ad13..1bab87a42 100644 --- a/localtests/compound-pk-ts/create.sql +++ b/localtests/compound-pk-ts/create.sql @@ -17,24 +17,24 @@ create event gh_ost_test enable do begin - insert into gh_ost_test values (null, 11, now(6), 0); + insert into gh_ost_test values (null, 11, sysdate(6), 0); update gh_ost_test set updated = 1 where i = 11 order by id desc limit 1; - insert into gh_ost_test values (null, 13, now(6), 0); + insert into gh_ost_test values (null, 13, sysdate(6), 0); update gh_ost_test set updated = 1 where i = 13 order by id desc limit 1; - insert into gh_ost_test values (null, 17, now(6), 0); + insert into gh_ost_test values (null, 17, sysdate(6), 0); update gh_ost_test set updated = 1 where i = 17 order by id desc limit 1; - insert into gh_ost_test values (null, 19, now(6), 0); + insert into gh_ost_test values (null, 19, sysdate(6), 0); update gh_ost_test set updated = 1 where i = 19 order by id desc limit 1; - insert into gh_ost_test values (null, 23, now(6), 0); + insert into gh_ost_test values (null, 23, sysdate(6), 0); update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1; - insert into gh_ost_test values (null, 29, now(6), 0); - insert into gh_ost_test values (null, 31, now(6), 0); - insert into gh_ost_test values (null, 37, now(6), 0); - insert into gh_ost_test values (null, 41, now(6), 0); + insert into gh_ost_test values (null, 29, sysdate(6), 0); + insert into gh_ost_test values (null, 31, sysdate(6), 0); + insert into gh_ost_test values (null, 37, sysdate(6), 0); + insert into gh_ost_test values (null, 41, sysdate(6), 0); delete from gh_ost_test where i = 31 order by id desc limit 1; end ;; diff --git a/localtests/compound-pk/create.sql b/localtests/compound-pk/create.sql index d45a69c2a..cf838d0a5 100644 --- a/localtests/compound-pk/create.sql +++ b/localtests/compound-pk/create.sql @@ -31,4 +31,10 @@ begin insert into gh_ost_test values (null, 23, 'twenty three', 0); update gh_ost_test set updated = 1 where i = 23 order by id desc limit 1; + + insert into gh_ost_test values (null, 29, 'twenty nine', 0); + insert into gh_ost_test values (null, 31, 'thirty one', 0); + insert into gh_ost_test values (null, 37, 'thirty seven', 0); + insert into gh_ost_test values (null, 41, 'forty one', 0); + delete from gh_ost_test where i = 31 order by id desc limit 1; end ;; From 0325bd02344c2a2dd11aee6b5dad56b5b4213cc8 Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Fri, 23 Oct 2020 00:56:54 +0200 Subject: [PATCH 4/4] Fix merge conflict --- localtests/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/localtests/test.sh b/localtests/test.sh index 03c33be10..0cf549028 100755 --- a/localtests/test.sh +++ b/localtests/test.sh @@ -211,8 +211,8 @@ test_single() { ghost_checksum=$(cat $ghost_content_output_file | md5sum) if [ "$orig_checksum" != "$ghost_checksum" ] ; then - gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss > ${orig_table_csv_file} - gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss > ${ghost_table_csv_file} + gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss > $orig_content_output_file + gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss > $ghost_content_output_file echo "ERROR $test_name: checksum mismatch" echo "---" diff $orig_content_output_file $ghost_content_output_file