summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_bug38231.test
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-08 10:31:34 -0200
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2009-01-08 10:31:34 -0200
commitf7e77185600f51107f4795db7ba8c405d7b707a5 (patch)
treee3f5068067564b99aca2a79a455dbe32afc20dff /mysql-test/t/innodb_bug38231.test
parent4bd55050adb67b35a4c15c327d06a52535811fe7 (diff)
downloadmariadb-git-f7e77185600f51107f4795db7ba8c405d7b707a5.tar.gz
Bug#41889: Test main.innodb_bug38231 is failing w/embedded server (server crash)
The problem is that a mysql connection instance is not thread-safe and reentrant, meaning that it can't be used concurrently and can't be re-entered while it's already running. This applies for any form of the server (embedded or not), but this rule can be violated in a test case if the test sends a new command without waiting for the result of previous command that was sent asynchronously and this can lead to hangs when over a network or to crashes under embedded server as the server query execution path will be re-entered concurrently with the same connection structure. The solution is to rework the test case so that the aforementioned rule is obeyed. mysql-test/t/innodb_bug38231.test: Remove con3 as it is not necessary to reproduce the test case and might cause problems as there is no guarantee on which LOCK TABLE request will succeed first. Also, wait for statement result before sending a new one on the same connection.
Diffstat (limited to 'mysql-test/t/innodb_bug38231.test')
-rw-r--r--mysql-test/t/innodb_bug38231.test14
1 files changed, 3 insertions, 11 deletions
diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/t/innodb_bug38231.test
index 5b87969f062..b3fcd89f371 100644
--- a/mysql-test/t/innodb_bug38231.test
+++ b/mysql-test/t/innodb_bug38231.test
@@ -16,7 +16,6 @@ CREATE TABLE bug38231 (a INT);
-- connect (con1,localhost,root,,)
-- connect (con2,localhost,root,,)
--- connect (con3,localhost,root,,)
-- connection con1
SET autocommit=0;
@@ -27,11 +26,6 @@ SET autocommit=0;
-- send
LOCK TABLE bug38231 WRITE;
--- connection con3
-SET autocommit=0;
--- send
-LOCK TABLE bug38231 WRITE;
-
-- connection default
-- send
TRUNCATE TABLE bug38231;
@@ -39,6 +33,7 @@ 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
# this crashes the server if the bug is present
UNLOCK TABLES;
@@ -46,16 +41,13 @@ UNLOCK TABLES;
# clean up
-- connection con2
-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