summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-10-14 00:06:17 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2022-10-17 15:24:45 +0300
commit9a1526e04824dc5f0b6660e42c0d65582993bc96 (patch)
tree65f703293312dd72d081b322c0d6b79c534cc6f7
parent181201afc97ebf3bd3c908de7bc07aac2d9608f0 (diff)
downloadmariadb-git-9a1526e04824dc5f0b6660e42c0d65582993bc96.tar.gz
fixup! MDEV-28943 add a few more tests
-rw-r--r--mysql-test/main/alter_table_lock.result29
-rw-r--r--mysql-test/main/alter_table_lock.test32
2 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/main/alter_table_lock.result b/mysql-test/main/alter_table_lock.result
index 5a787055478..37437a6bd7d 100644
--- a/mysql-test/main/alter_table_lock.result
+++ b/mysql-test/main/alter_table_lock.result
@@ -44,6 +44,35 @@ connection con1;
must be 0
0
connection default;
+insert t1 values (1);
+lock table t1 read local;
+alter table t1 force, algorithm=copy, lock=none;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=none;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=copy, lock=shared;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=shared;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=copy, lock=exclusive;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=exclusive;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+lock table t1 write concurrent;
+alter table t1 force, algorithm=copy, lock=none;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=none;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=copy, lock=shared;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=shared;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=copy, lock=exclusive;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+alter table t1 force, algorithm=inplace, lock=exclusive;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
drop table t1;
#
# MDEV-29056 Replica SQL thread stops with 1846 error on ALTER ONLINE after LOCK WRITE
diff --git a/mysql-test/main/alter_table_lock.test b/mysql-test/main/alter_table_lock.test
index 6fe717f977e..84d964c107f 100644
--- a/mysql-test/main/alter_table_lock.test
+++ b/mysql-test/main/alter_table_lock.test
@@ -60,6 +60,38 @@ unlock tables;
--connection con1
--reap
--connection default
+
+insert t1 values (1);
+lock table t1 read local;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=none;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=none;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=shared;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=shared;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=exclusive;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=exclusive;
+unlock tables;
+
+lock table t1 write concurrent;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=none;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=none;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=shared;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=shared;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=copy, lock=exclusive;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+alter table t1 force, algorithm=inplace, lock=exclusive;
+unlock tables;
+
drop table t1;
--echo #