mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
Applying InnoDB snapshot
Detailed revision comments: r6785 | vasil | 2010-03-10 09:04:38 +0200 (Wed, 10 Mar 2010) | 11 lines branches/5.1: Add the missing --reap statements in innodb_bug38231.test. Probably MySQL enforced the presence of those recently and the test started failing like: main.innodb_bug38231 [ fail ] Test ended at 2010-03-10 08:48:32 CURRENT_TEST: main.innodb_bug38231 mysqltest: At line 49: Cannot run query on connection between send and reap r6788 | vasil | 2010-03-10 10:53:21 +0200 (Wed, 10 Mar 2010) | 8 lines branches/5.1: In innodb_bug38231.test: replace the fragile sleep 0.2 that depends on timing with a more robust condition which waits for the TRUNCATE and LOCK commands to appear in information_schema.processlist. This could also break if there are other sessions executing the same SQL commands, but there are none during the execution of the mysql test.
This commit is contained in:
@@ -16,6 +16,7 @@ CREATE TABLE bug38231 (a INT);
|
||||
|
||||
-- connect (con1,localhost,root,,)
|
||||
-- connect (con2,localhost,root,,)
|
||||
-- connect (con3,localhost,root,,)
|
||||
|
||||
-- connection con1
|
||||
SET autocommit=0;
|
||||
@@ -26,15 +27,30 @@ SET autocommit=0;
|
||||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
-- connection con3
|
||||
SET autocommit=0;
|
||||
-- send
|
||||
LOCK TABLE bug38231 WRITE;
|
||||
|
||||
-- connection default
|
||||
-- send
|
||||
TRUNCATE TABLE bug38231;
|
||||
|
||||
-- connection con1
|
||||
# give time to TRUNCATE and others to be executed; without sleep, sometimes
|
||||
# UNLOCK executes before TRUNCATE
|
||||
# TODO: Replace with wait_condition once possible under embedded server.
|
||||
-- sleep 0.2
|
||||
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
|
||||
# sometimes UNLOCK executes before them. We assume there are no other
|
||||
# sessions executing at the same time with the same SQL commands.
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = 'TRUNCATE TABLE bug38231';
|
||||
-- source include/wait_condition.inc
|
||||
let $wait_condition =
|
||||
SELECT COUNT(*) = 2 FROM information_schema.processlist
|
||||
WHERE info = 'LOCK TABLE bug38231 WRITE';
|
||||
-- source include/wait_condition.inc
|
||||
# the above enables query log, re-disable it
|
||||
-- disable_query_log
|
||||
|
||||
# this crashes the server if the bug is present
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -44,10 +60,16 @@ UNLOCK TABLES;
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection con3
|
||||
-- reap
|
||||
UNLOCK TABLES;
|
||||
|
||||
-- connection default
|
||||
-- reap
|
||||
|
||||
-- disconnect con1
|
||||
-- disconnect con2
|
||||
-- disconnect con3
|
||||
|
||||
# test that TRUNCATE works with with row-level locks
|
||||
|
||||
|
Reference in New Issue
Block a user