MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:November 22 2007 12:18pm
Subject:bk commit into 5.0 tree (davi:1.2563) BUG#32528
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of davi. When davi does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-22 10:18:19-02:00, davi@stripped +3 -0
  Bug#32528 Global read lock with a low priority write lock causes a server crash
  
  FLUSH TABLES WITH READ LOCK fails to properly detect write locked
  tables when running under low priority updates.
  
  The problem is that when trying to aspire a global read lock, the
  reload_acl_and_cache() function fails to properly check if the thread
  has a low priority write lock, which later my cause a server crash or
  deadlock.
  
  The solution is to simple check if the thread has any type of the
  possible exclusive write locks.

  mysql-test/r/flush.result@stripped, 2007-11-22 10:18:18-02:00, davi@stripped +17 -0
    Add test case result for Bug#32528

  mysql-test/t/flush.test@stripped, 2007-11-22 10:18:18-02:00, davi@stripped +31 -0
    Add test case for Bug#32528

  sql/sql_parse.cc@stripped, 2007-11-22 10:18:18-02:00, davi@stripped +1 -1
    Although it should not matter under LOCK TABLES, use TL_WRITE_ALLOW_WRITE
    to emphasize that it should fail in case of any write lock.

diff -Nrup a/mysql-test/r/flush.result b/mysql-test/r/flush.result
--- a/mysql-test/r/flush.result	2006-10-04 09:09:34 -02:00
+++ b/mysql-test/r/flush.result	2007-11-22 10:18:18 -02:00
@@ -55,3 +55,20 @@ 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;
diff -Nrup a/mysql-test/t/flush.test b/mysql-test/t/flush.test
--- a/mysql-test/t/flush.test	2006-11-16 17:19:23 -02:00
+++ b/mysql-test/t/flush.test	2007-11-22 10:18:18 -02:00
@@ -133,4 +133,35 @@ 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;
+
 # End of 5.0 tests
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2007-10-23 11:48:56 -02:00
+++ b/sql/sql_parse.cc	2007-11-22 10:18:18 -02:00
@@ -7054,7 +7054,7 @@ bool reload_acl_and_cache(THD *thd, ulon
 
         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;
Thread
bk commit into 5.0 tree (davi:1.2563) BUG#32528Davi Arnaut22 Nov