summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/flush.result17
-rw-r--r--mysql-test/t/flush.test31
-rw-r--r--sql/sql_parse.cc2
3 files changed, 49 insertions, 1 deletions
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index dcbffd6f7c8..f1b6c471943 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -55,6 +55,23 @@ flush tables with read lock;
insert into t2 values(1);
unlock tables;
drop table t1, t2;
+drop table if exists t1, t2;
+set session low_priority_updates=1;
+create table t1 (a int);
+create table t2 (b int);
+lock tables t1 write;
+flush tables with read lock;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+lock tables t1 read, t2 write;
+flush tables with read lock;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+lock tables t1 read;
+flush tables with read lock;
+unlock tables;
+drop table t1, t2;
+set session low_priority_updates=default;
End of 5.0 tests
set @old_general_log= @@general_log;
set @old_read_only= @@read_only;
diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test
index d58d038c3ea..794423ca211 100644
--- a/mysql-test/t/flush.test
+++ b/mysql-test/t/flush.test
@@ -133,6 +133,37 @@ disconnect con3;
connection default;
drop table t1, t2;
+#
+# Bug#32528 Global read lock with a low priority write lock causes a server crash
+#
+
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+
+set session low_priority_updates=1;
+
+create table t1 (a int);
+create table t2 (b int);
+
+lock tables t1 write;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+flush tables with read lock;
+unlock tables;
+
+lock tables t1 read, t2 write;
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+flush tables with read lock;
+unlock tables;
+
+lock tables t1 read;
+flush tables with read lock;
+unlock tables;
+
+drop table t1, t2;
+
+set session low_priority_updates=default;
+
--echo End of 5.0 tests
#
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7e194ac76dc..f6a1938d8e2 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -6412,7 +6412,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
for (; lock_p < end_p; lock_p++)
{
- if ((*lock_p)->type == TL_WRITE)
+ if ((*lock_p)->type >= TL_WRITE_ALLOW_WRITE)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return 1;