From: Vinay Fisrekar Date: May 8 2012 5:46am Subject: bzr push into mysql-trunk-wl6168 branch (vinay.fisrekar:3874 to 3875) List-Archive: http://lists.mysql.com/commits/143749 Message-Id: <201205080547.q485lthu004466@vinayf-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3875 Vinay Fisrekar 2012-05-08 Adding 2 more test based on Paul's mail/qusetions modified: mysql-test/r/flush_table.result mysql-test/t/flush_table.test 3874 Jon Olav Hauglid 2012-05-04 WL#6169 FLUSH TABLES ... FOR EXPORT -- runtime Test case polish. modified: mysql-test/r/flush_table.result mysql-test/t/flush_table.test === modified file 'mysql-test/r/flush_table.result' --- a/mysql-test/r/flush_table.result 2012-05-04 13:12:29 +0000 +++ b/mysql-test/r/flush_table.result 2012-05-08 05:43:55 +0000 @@ -401,4 +401,50 @@ i 200 UNLOCK TABLE; DROP TABLE t1; +# Test 12: Active transaction get committed if user execute +# "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.." +# Connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +INSERT INTO t1 VALUES (100),(200); +START TRANSACTION; +INSERT INTO t1 VALUES (300); +# 'flush table..' commit active transaction from same session +FLUSH LOCAL TABLES test.t1 FOR EXPORT; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +i +100 +200 +300 +START TRANSACTION; +INSERT INTO t1 VALUES (400); +# 'lock table ..' commit active transaction from same session +LOCK TABLES test.t1 READ; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +i +100 +200 +300 +400 +UNLOCK TABLES; +DROP TABLE t1; +# Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.." +# in same session +# Connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +# Lock table +LOCK TABLES test.t1 WRITE; +# 'lock table ..' completes even if table lock is acquired +# in same session using 'lock table'. Previous locks are released. +LOCK TABLES test.t1 READ; +# 'flush table ..' gives error if table lock is acquired +# in same session using 'lock table ..' +FLUSH TABLES test.t1 FOR EXPORT; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +# 'lock table ..' completes even if table lock is acquired +# in same session using 'flush table'. Previous locks are released. +LOCK TABLES test.t1 WRITE; +UNLOCK TABLES; +DROP TABLE t1; # End of 5.6 tests === modified file 'mysql-test/t/flush_table.test' --- a/mysql-test/t/flush_table.test 2012-05-04 13:12:29 +0000 +++ b/mysql-test/t/flush_table.test 2012-05-08 05:43:55 +0000 @@ -602,6 +602,49 @@ SELECT * FROM t1 ORDER BY i; UNLOCK TABLE; DROP TABLE t1; +--echo # Test 12: Active transaction get committed if user execute +--echo # "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.." + +--echo # Connection default +--connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +INSERT INTO t1 VALUES (100),(200); +START TRANSACTION; +INSERT INTO t1 VALUES (300); +--echo # 'flush table..' commit active transaction from same session +FLUSH LOCAL TABLES test.t1 FOR EXPORT; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +START TRANSACTION; +INSERT INTO t1 VALUES (400); +--echo # 'lock table ..' commit active transaction from same session +LOCK TABLES test.t1 READ; +ROLLBACK; +SELECT * FROM t1 ORDER BY i; +UNLOCK TABLES; +DROP TABLE t1; + +--echo # Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.." +--echo # in same session +--echo # Connection default + +--connection default +CREATE TABLE t1 ( i INT ) ENGINE = Innodb; +--echo # Lock table +LOCK TABLES test.t1 WRITE; +--echo # 'lock table ..' completes even if table lock is acquired +--echo # in same session using 'lock table'. Previous locks are released. +LOCK TABLES test.t1 READ; +--echo # 'flush table ..' gives error if table lock is acquired +--echo # in same session using 'lock table ..' +--error ER_LOCK_OR_ACTIVE_TRANSACTION +FLUSH TABLES test.t1 FOR EXPORT; +--echo # 'lock table ..' completes even if table lock is acquired +--echo # in same session using 'flush table'. Previous locks are released. +LOCK TABLES test.t1 WRITE; +UNLOCK TABLES; +DROP TABLE t1; + --connection con1 --disconnect con1 --source include/wait_until_disconnected.inc No bundle (reason: useless for push emails).