From dd9a3e1d0c7286583e7add5a0d76b16e979325fb Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 10 Jan 2017 12:35:42 +0200 Subject: [PATCH] adding PK, UK, PK-to-UK conversion tests --- localtests/fail-no-shared-uk/create.sql | 22 +++++++++++++++++++ localtests/fail-no-shared-uk/expect_failure | 1 + localtests/fail-no-shared-uk/extra_args | 1 + localtests/swap-pk-uk/create.sql | 24 +++++++++++++++++++++ localtests/swap-pk-uk/extra_args | 1 + localtests/swap-pk-uk/order_by | 1 + localtests/swap-uk/create.sql | 22 +++++++++++++++++++ localtests/swap-uk/extra_args | 1 + 8 files changed, 73 insertions(+) create mode 100644 localtests/fail-no-shared-uk/create.sql create mode 100644 localtests/fail-no-shared-uk/expect_failure create mode 100644 localtests/fail-no-shared-uk/extra_args create mode 100644 localtests/swap-pk-uk/create.sql create mode 100644 localtests/swap-pk-uk/extra_args create mode 100644 localtests/swap-pk-uk/order_by create mode 100644 localtests/swap-uk/create.sql create mode 100644 localtests/swap-uk/extra_args diff --git a/localtests/fail-no-shared-uk/create.sql b/localtests/fail-no-shared-uk/create.sql new file mode 100644 index 0000000..5bb45f2 --- /dev/null +++ b/localtests/fail-no-shared-uk/create.sql @@ -0,0 +1,22 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + ts timestamp, + primary key(id) +) 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()); + insert into gh_ost_test values (null, 13, now()); + insert into gh_ost_test values (null, 17, now()); +end ;; diff --git a/localtests/fail-no-shared-uk/expect_failure b/localtests/fail-no-shared-uk/expect_failure new file mode 100644 index 0000000..d3ef0f1 --- /dev/null +++ b/localtests/fail-no-shared-uk/expect_failure @@ -0,0 +1 @@ +No shared unique key can be found after ALTER diff --git a/localtests/fail-no-shared-uk/extra_args b/localtests/fail-no-shared-uk/extra_args new file mode 100644 index 0000000..379a77d --- /dev/null +++ b/localtests/fail-no-shared-uk/extra_args @@ -0,0 +1 @@ +--alter="drop primary key, add primary key (id, i)" diff --git a/localtests/swap-pk-uk/create.sql b/localtests/swap-pk-uk/create.sql new file mode 100644 index 0000000..aa712b8 --- /dev/null +++ b/localtests/swap-pk-uk/create.sql @@ -0,0 +1,24 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id bigint, + i int not null, + ts timestamp(6), + primary key(id), + unique key its_uidx(i, ts) +) ; + +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 ((unix_timestamp() << 2) + 0, 11, now(6)); + insert into gh_ost_test values ((unix_timestamp() << 2) + 1, 13, now(6)); + insert into gh_ost_test values ((unix_timestamp() << 2) + 2, 17, now(6)); + insert into gh_ost_test values ((unix_timestamp() << 2) + 3, 19, now(6)); +end ;; diff --git a/localtests/swap-pk-uk/extra_args b/localtests/swap-pk-uk/extra_args new file mode 100644 index 0000000..f4de64a --- /dev/null +++ b/localtests/swap-pk-uk/extra_args @@ -0,0 +1 @@ +--alter="drop primary key, drop key its_uidx, add primary key (i, ts), add unique key id_uidx(id)" diff --git a/localtests/swap-pk-uk/order_by b/localtests/swap-pk-uk/order_by new file mode 100644 index 0000000..074d1ee --- /dev/null +++ b/localtests/swap-pk-uk/order_by @@ -0,0 +1 @@ +id diff --git a/localtests/swap-uk/create.sql b/localtests/swap-uk/create.sql new file mode 100644 index 0000000..5bb45f2 --- /dev/null +++ b/localtests/swap-uk/create.sql @@ -0,0 +1,22 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + ts timestamp, + primary key(id) +) 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()); + insert into gh_ost_test values (null, 13, now()); + insert into gh_ost_test values (null, 17, now()); +end ;; diff --git a/localtests/swap-uk/extra_args b/localtests/swap-uk/extra_args new file mode 100644 index 0000000..ad80561 --- /dev/null +++ b/localtests/swap-uk/extra_args @@ -0,0 +1 @@ +--alter="drop primary key, add unique key(id)"