1# Save the initial number of concurrent sessions 2# Establish connection con1 (user=root) 3# Establish connection con2 (user=root) 4# Establish connection con3 (user=root) 5# Switch to connection con1 6DROP TABLE IF EXISTS t1; 7CREATE TABLE t1 (a INT) ENGINE=innodb; 8BEGIN; 9INSERT INTO t1 VALUES(1); 10# Switch to connection con2 11FLUSH TABLES WITH READ LOCK; 12# Switch to connection con1 13# Sending: 14COMMIT; 15# Switch to connection con2 16# Wait until COMMIT gets blocked. 17# Verify that 'con1' was blocked and data did not move. 18SELECT * FROM t1; 19a 20UNLOCK TABLES; 21# Switch to connection con1 22# Reaping COMMIT 23# Switch to connection con1 24BEGIN; 25SELECT * FROM t1 FOR UPDATE; 26a 271 28# Switch to connection con2 29BEGIN; 30SELECT * FROM t1 FOR UPDATE; 31# Switch to connection con3 32FLUSH TABLES WITH READ LOCK; 33# Switch to connection con1 34COMMIT; 35# Switch to connection con2 36a 371 38COMMIT; 39# Switch to connection con3 40UNLOCK TABLES; 41# Switch to connection con2 42COMMIT; 43# Switch to connection con1 44BEGIN; 45INSERT INTO t1 VALUES(10); 46FLUSH TABLES WITH READ LOCK; 47# Switch to connection con2 48FLUSH TABLES WITH READ LOCK; 49UNLOCK TABLES; 50BEGIN; 51SELECT * FROM t1; 52a 531 5410 55SHOW CREATE DATABASE test; 56Database Create Database 57test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ 58COMMIT; 59# Cleanup 60# Switch to connection default and close connections con1, con2, con3 61# We commit open transactions when we disconnect: only then we can 62# drop the table. 63DROP TABLE t1; 64# End of 4.1 tests 65# Wait till all disconnects are completed 66