3777 Dmitry Shulga 2012-03-15
Follow-up patch for bug#13070308.
After the patch that fixes the original bug had been pushed
the xa.test began to fail sporadically with the following
diagnostics:
query 'reap' failed with wrong errno 1205: 'Lock wait
timeout exceeded; try restarting transaction', instead of 1213...
It seems that the reason for such sporadically failure is a race condition
in checking for 'Sending data' state in wait_condition loop and acquiring
a real transaction lock during execution of statement 'INSERT SELECT'.
Such race condition arised since there was a time window between the step
when server sets a session state in 'Sending data' value and when the real lock
for transation is acquired. Such race condition could result in successful
execution of the following statement 'DELETE' that else would be failed with
error ER_LOCK_DEADLOCK. As a consequences the XA COMMIT for distributed
tarnsaction doesn't return any info about deadlock condition arised.
To eliminate this race condition we replaced the conditon of waiting for
lock by polling the table information_schema.innodb_trx until transaction will
be locked.
modified:
mysql-test/r/xa.result
mysql-test/t/xa.test
3776 Dmitry Shulga 2012-03-15 [merge]
Automerge of patch for bug#13737343 from mysq-5.5 tree.
modified:
mysql-test/r/xa.result
mysql-test/t/xa.test
sql/transaction.cc
=== modified file 'mysql-test/r/xa.result'
--- a/mysql-test/r/xa.result 2012-03-15 09:47:17 +0000
+++ b/mysql-test/r/xa.result 2012-03-15 09:54:32 +0000
@@ -214,7 +214,8 @@ XA START 'xid1';
# Sending:
INSERT INTO t2 SELECT a FROM t1;
# Connection default
-# Waiting until INSERT ... is blocked
+# Waiting for until a transaction with 'INSERT SELECT'
+# will be locked inside innodb subsystem.
DELETE FROM t1;
# Connection con2
# Reaping: INSERT INTO t2 SELECT a FROM t1
=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test 2012-03-15 09:47:17 +0000
+++ b/mysql-test/t/xa.test 2012-03-15 09:54:32 +0000
@@ -356,12 +356,16 @@ XA START 'xid1';
--echo # Connection default
--connection default
+--echo # Waiting for until a transaction with 'INSERT SELECT'
+--echo # will be locked inside innodb subsystem.
+
let $wait_condition=
- SELECT COUNT(*) = 1 FROM information_schema.processlist
- WHERE state = "Sending data"
- AND info = "INSERT INTO t2 SELECT a FROM t1";
---echo # Waiting until INSERT ... is blocked
+ SELECT COUNT(*) = 1 FROM information_schema.innodb_trx
+ WHERE trx_query = 'INSERT INTO t2 SELECT a FROM t1' AND
+ trx_operation_state = 'starting index read' AND
+ trx_state = 'LOCK WAIT';
--source include/wait_condition.inc
+
DELETE FROM t1;
--echo # Connection con2
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (Dmitry.Shulga:3776 to 3777) Bug#13070308 | Dmitry Shulga | 15 Mar |