MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:November 28 2007 12:18pm
Subject:bk commit into 5.0 tree (davi:1.2588) BUG#31479
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-28 10:18:01-02:00, davi@stripped +3 -0
  Bug#31479 Bad lock interaction if CREATE TABLE LIKE is killed
  
  Kill of a CREATE TABLE source_table LIKE statement waiting for a
  name-lock on the source table causes a bad lock interaction.
  
  The mysql_create_like_table() has a bug that if the connection is
  killed while waiting for the name-lock on the source table, it will
  jump to the wrong error path and try to unlock the source table and
  LOCK_open, but both weren't locked.
  
  The solution is to simple return when the name lock request is killed,
  it's safe to do so because no lock was acquired and no cleanup is needed.
  
  Original bug report also contains description of other problems
  related to this scenario but they either already fixed in 5.1 or
  will be addressed separately (see bug report for details).

  mysql-test/r/lock_multi.result@stripped, 2007-11-28 10:18:00-02:00, davi@stripped +11 -0
    Add test case result for Bug#31479

  mysql-test/t/lock_multi.test@stripped, 2007-11-28 10:18:00-02:00, davi@stripped +32 -0
    Add test case for Bug#31479

  sql/sql_table.cc@stripped, 2007-11-28 10:18:00-02:00, davi@stripped +1 -1
    Rerturn TRUE when the lock gets killed.

diff -Nrup a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result
--- a/mysql-test/r/lock_multi.result	2006-10-04 09:09:34 -02:00
+++ b/mysql-test/r/lock_multi.result	2007-11-28 10:18:00 -02:00
@@ -88,3 +88,14 @@ alter table t1 auto_increment=0; alter t
 alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
 unlock tables;
 drop table t1;
+drop table if exists t1;
+create table t1 (a int);
+connection: locker
+lock tables t1 read;
+connection: writer
+create table t2 like t1;;
+connection: default
+kill query
+ERROR 70100: Query execution was interrupted
+unlock tables;
+drop table t1;
diff -Nrup a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test
--- a/mysql-test/t/lock_multi.test	2007-02-26 08:49:23 -02:00
+++ b/mysql-test/t/lock_multi.test	2007-11-28 10:18:00 -02:00
@@ -249,4 +249,36 @@ reap;
 connection locker;
 drop table t1;
 
+#
+# Bug#31479 Bad lock interaction if CREATE TABLE LIKE is killed
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int);
+--echo connection: locker
+connection locker;
+lock tables t1 read;
+--echo connection: writer
+connection writer;
+let $ID= `select connection_id()`;
+--send create table t2 like t1;
+--echo connection: default
+connection default;
+let $show_type= open tables where in_use=2 and name_locked=1;
+let $show_pattern= '%t1%2%1';
+--source include/wait_show_pattern.inc
+--echo kill query
+disable_query_log;
+eval kill query $ID;
+enable_query_log;
+connection writer;
+--error ER_QUERY_INTERRUPTED
+--reap
+connection locker;
+unlock tables;
+connection default;
+drop table t1;
+
 # End of 5.0 tests
diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc	2007-10-29 11:53:06 -02:00
+++ b/sql/sql_table.cc	2007-11-28 10:18:00 -02:00
@@ -2761,7 +2761,7 @@ bool mysql_create_like_table(THD* thd, T
     operations on the target table.
   */
   if (lock_and_wait_for_table_name(thd, src_table))
-    goto err;
+    DBUG_RETURN(res);
 
   pthread_mutex_lock(&LOCK_open);
 
Thread
bk commit into 5.0 tree (davi:1.2588) BUG#31479Davi Arnaut28 Nov
  • Re: bk commit into 5.0 tree (davi:1.2588) BUG#31479Dmitri Lenev28 Nov