mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
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.
This commit is contained in:
@ -16,7 +16,6 @@ CREATE TABLE bug38231 (a INT);
|
|||||||
|
|
||||||
-- connect (con1,localhost,root,,)
|
-- connect (con1,localhost,root,,)
|
||||||
-- connect (con2,localhost,root,,)
|
-- connect (con2,localhost,root,,)
|
||||||
-- connect (con3,localhost,root,,)
|
|
||||||
|
|
||||||
-- connection con1
|
-- connection con1
|
||||||
SET autocommit=0;
|
SET autocommit=0;
|
||||||
@ -27,11 +26,6 @@ SET autocommit=0;
|
|||||||
-- send
|
-- send
|
||||||
LOCK TABLE bug38231 WRITE;
|
LOCK TABLE bug38231 WRITE;
|
||||||
|
|
||||||
-- connection con3
|
|
||||||
SET autocommit=0;
|
|
||||||
-- send
|
|
||||||
LOCK TABLE bug38231 WRITE;
|
|
||||||
|
|
||||||
-- connection default
|
-- connection default
|
||||||
-- send
|
-- send
|
||||||
TRUNCATE TABLE bug38231;
|
TRUNCATE TABLE bug38231;
|
||||||
@ -39,6 +33,7 @@ TRUNCATE TABLE bug38231;
|
|||||||
-- connection con1
|
-- connection con1
|
||||||
# give time to TRUNCATE and others to be executed; without sleep, sometimes
|
# give time to TRUNCATE and others to be executed; without sleep, sometimes
|
||||||
# UNLOCK executes before TRUNCATE
|
# UNLOCK executes before TRUNCATE
|
||||||
|
# TODO: Replace with wait_condition once possible under embedded server.
|
||||||
-- sleep 0.2
|
-- sleep 0.2
|
||||||
# this crashes the server if the bug is present
|
# this crashes the server if the bug is present
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
@ -46,16 +41,13 @@ UNLOCK TABLES;
|
|||||||
# clean up
|
# clean up
|
||||||
|
|
||||||
-- connection con2
|
-- connection con2
|
||||||
UNLOCK TABLES;
|
-- reap
|
||||||
|
|
||||||
-- connection con3
|
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
-- connection default
|
-- connection default
|
||||||
|
-- reap
|
||||||
-- disconnect con1
|
-- disconnect con1
|
||||||
-- disconnect con2
|
-- disconnect con2
|
||||||
-- disconnect con3
|
|
||||||
|
|
||||||
# test that TRUNCATE works with with row-level locks
|
# test that TRUNCATE works with with row-level locks
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user