Commit 1bbb55a2 authored by unknown's avatar unknown

MBug#687320: Fix sporadic test failures in innodb_mysql.test and...

MBug#687320: Fix sporadic test failures in innodb_mysql.test and partition_innodb_semi_consistent.test

Problem is that these tests run with --innodb-lock-wait-timeout=2 in .opt
(and this is necessary as built-in innodb does not allow to change this
dynamically). This cases another part of the test to occasionally time
out an UPDATE, which subsequently caused the test case to timeout due to
waiting for a condition (successful UPDATE) that never occurs.

Fixed by re-trying the update in case of timeout.

Tested by inserting a sleep() in the connection that the UPDATE is waiting
for, and checking that the retry loops a couple of times until the other
connection is done and COMMITs.
parent adb9fd95
......@@ -1359,7 +1359,17 @@ INSERT INTO t1 VALUES (1,'init');
DELIMITER |;
CREATE PROCEDURE p1()
BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES ();
END|
DELIMITER ;|
......
......@@ -75,7 +75,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1()
BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES ();
END|
BEGIN;
......
......@@ -1594,7 +1594,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1()
BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES ();
END|
BEGIN;
......
......@@ -1594,7 +1594,17 @@ TRUNCATE t1;
INSERT INTO t1 VALUES (1,'init');
CREATE PROCEDURE p1()
BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES ();
END|
BEGIN;
......
......@@ -117,7 +117,17 @@ INSERT INTO t1 VALUES (1,'init');
DELIMITER |;
CREATE PROCEDURE p1()
BEGIN
# retry the UPDATE in case it times out the lock before con1 has time
# to COMMIT.
DECLARE do_retry INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1;
retry_loop:LOOP
UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1;
IF do_retry = 0 THEN
LEAVE retry_loop;
END IF;
SET do_retry = 0;
END LOOP;
INSERT INTO t2 VALUES ();
END|
DELIMITER ;|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment