MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:May 19 2010 11:32am
Subject:bzr commit into mysql-trunk-runtime branch (jon.hauglid:3020) Bug#53798
View as plain text  
#At file:///export/home/z/mysql-trunk-runtime-newbug/ based on revid:jon.hauglid@stripped

 3020 Jon Olav Hauglid	2010-05-19
      Bug #53798 OPTIMIZE TABLE breaks repeatable read
      
      The problem was that OPTMIZE TABLE was allowed to run on a table
      in use by a transaction in a different connection. This caused
      repeatable read to break.
      
      This bug was fixed by the introduction of metadata locking, WL#4284.
      OPTIMIZE TABLE will now be blocked until the transaction using the
      table, has ended.
      
      This patch contains a regression test added to innodb_mysql_lock.test
      and no code changes.

    modified:
      mysql-test/r/innodb_mysql_lock.result
      mysql-test/t/innodb_mysql_lock.test
=== modified file 'mysql-test/r/innodb_mysql_lock.result'
--- a/mysql-test/r/innodb_mysql_lock.result	2010-02-01 11:43:06 +0000
+++ b/mysql-test/r/innodb_mysql_lock.result	2010-05-19 11:32:21 +0000
@@ -86,3 +86,33 @@ release_lock('bug42147_lock')
 UNLOCK TABLES;
 # Connection 1
 DROP TABLE t1;
+#
+# Bug#53798 OPTIMIZE TABLE breaks repeatable read
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT) engine=innodb;
+INSERT INTO t1 VALUES (1), (2), (3);
+# Connection con1
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SELECT * FROM t1;
+a
+1
+2
+3
+# Connection default
+# This should block
+# Sending:
+OPTIMIZE TABLE t1;
+# Connection con1
+SELECT * FROM t1;
+a
+1
+2
+3
+COMMIT;
+# Connection default
+# Reaping OPTIMIZE TABLE t1
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	status	OK
+DROP TABLE t1;

=== modified file 'mysql-test/t/innodb_mysql_lock.test'
--- a/mysql-test/t/innodb_mysql_lock.test	2010-02-01 11:43:06 +0000
+++ b/mysql-test/t/innodb_mysql_lock.test	2010-05-19 11:32:21 +0000
@@ -170,6 +170,45 @@ connection default;
 disconnect con2;
 DROP TABLE t1;
 
+
+--echo #
+--echo # Bug#53798 OPTIMIZE TABLE breaks repeatable read
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT) engine=innodb;
+INSERT INTO t1 VALUES (1), (2), (3);
+
+--echo # Connection con1
+connect (con1, localhost, root);
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SELECT * FROM t1;
+
+--echo # Connection default
+connection default;
+--echo # This should block
+--echo # Sending:
+--send OPTIMIZE TABLE t1
+
+--echo # Connection con1
+connection con1;
+let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist
+  WHERE state='Waiting for table' AND info='OPTIMIZE TABLE t1';
+--source include/wait_condition.inc
+SELECT * FROM t1;
+COMMIT;
+
+--echo # Connection default
+connection default;
+--echo # Reaping OPTIMIZE TABLE t1
+--reap
+disconnect con1;
+DROP TABLE t1;
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc


Attachment: [text/bzr-bundle] bzr/jon.hauglid@sun.com-20100519113221-47d2ye4me5rgbj0q.bundle
Thread
bzr commit into mysql-trunk-runtime branch (jon.hauglid:3020) Bug#53798Jon Olav Hauglid19 May
  • Re: bzr commit into mysql-trunk-runtime branch (jon.hauglid:3020)Bug#53798Konstantin Osipov19 May