Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Galera MTR Tests: MW-308 , MW-307, GCF-992
* a dedicated test for wsrep_retry_autocommit * some galera_toi_* tests were only passing because wsrep_retry_autocommit was in effect. The tests were changed to do not use autocommit * higher timeout values in galera_2nodes.cnf , galera_3nodes.cnf Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
- Loading branch information
1 parent
09d8fbc
commit 9b13147
Showing
11 changed files
with
168 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; | ||
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); | ||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; | ||
SET SESSION wsrep_retry_autocommit = 0; | ||
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;; | ||
TRUNCATE TABLE t1;; | ||
SELECT COUNT(*) = 1000000 FROM t1; | ||
COUNT(*) = 1000000 | ||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction | ||
SELECT COUNT(*) = 0 FROM t1; | ||
COUNT(*) = 0 | ||
1 | ||
DROP TABLE t1; | ||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; | ||
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;; | ||
TRUNCATE TABLE t1;; | ||
SELECT COUNT(*) = 1000000 FROM t1; | ||
COUNT(*) = 1000000 | ||
SELECT COUNT(*) = 0 FROM t1; | ||
COUNT(*) = 0 | ||
1 | ||
DROP TABLE t1; | ||
DROP TABLE ten; |
32 changes: 32 additions & 0 deletions
32
mysql-test/suite/galera/r/galera_var_retry_autocommit.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; | ||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f2 = SLEEP(5); | ||
SET SESSION wsrep_retry_autocommit = 0; | ||
INSERT INTO t1 (f1) VALUES (1),(2);; | ||
TRUNCATE TABLE t1; | ||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction | ||
SET SESSION wsrep_retry_autocommit = 1; | ||
INSERT INTO t1 (f1) VALUES (3),(4);; | ||
TRUNCATE TABLE t1; | ||
SELECT * FROM test.t1; | ||
f1 f2 | ||
3 0 | ||
4 0 | ||
CREATE PROCEDURE repeated_truncate () | ||
BEGIN | ||
DECLARE i INT; | ||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; | ||
SET i = 0; | ||
WHILE i <= 1000 DO | ||
TRUNCATE TABLE t1; | ||
SET i = i + 1; | ||
END WHILE; | ||
END| | ||
CALL repeated_truncate(); | ||
SET SESSION wsrep_retry_autocommit = 1; | ||
INSERT INTO t1 (f1) VALUES (5),(6); | ||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction | ||
SET SESSION wsrep_retry_autocommit = 1024; | ||
INSERT INTO t1 (f1) VALUES (7),(8);; | ||
include/diff_servers.inc [servers=1 2] | ||
DROP TABLE t1; | ||
DROP PROCEDURE repeated_truncate; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
mysql-test/suite/galera/t/galera_var_retry_autocommit.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# | ||
# Test that the wsrep_retry_autocommit variable is respected. We use an INSERT that | ||
# proceeds very slowly due to extra SLEEP() in a trigger | ||
# | ||
|
||
--source include/galera_cluster.inc | ||
|
||
--connection node_1 | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; | ||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f2 = SLEEP(5); | ||
|
||
# | ||
# With wsrep_retry_autocommit = 0, error is certain | ||
# | ||
|
||
--connection node_1 | ||
SET SESSION wsrep_retry_autocommit = 0; | ||
--send INSERT INTO t1 (f1) VALUES (1),(2); | ||
|
||
--connection node_2 | ||
--sleep 1 | ||
TRUNCATE TABLE t1; | ||
|
||
--connection node_1 | ||
--error ER_LOCK_DEADLOCK | ||
--reap | ||
|
||
# | ||
# With wsrep_retry_autocommit = 1, success against one TRUNCATE | ||
# | ||
|
||
--connection node_1 | ||
SET SESSION wsrep_retry_autocommit = 1; | ||
--send INSERT INTO t1 (f1) VALUES (3),(4); | ||
|
||
--connection node_2 | ||
--sleep 1 | ||
TRUNCATE TABLE t1; | ||
|
||
--connection node_1 | ||
--error 0 | ||
--reap | ||
SELECT * FROM test.t1; | ||
|
||
# | ||
# With wsrep_retry_autocommit = 1, failure against multiple TRUNCATEs | ||
# | ||
|
||
--connection node_2 | ||
DELIMITER |; | ||
CREATE PROCEDURE repeated_truncate () | ||
BEGIN | ||
DECLARE i INT; | ||
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; | ||
|
||
SET i = 0; | ||
WHILE i <= 1000 DO | ||
TRUNCATE TABLE t1; | ||
SET i = i + 1; | ||
END WHILE; | ||
END| | ||
DELIMITER ;| | ||
|
||
# Begin streaming TRUNCATEs | ||
--let $truncate_connection_id = `SELECT CONNECTION_ID()` | ||
--send CALL repeated_truncate() | ||
|
||
--connection node_1 | ||
SET SESSION wsrep_retry_autocommit = 1; | ||
--sleep 1 | ||
--error ER_LOCK_DEADLOCK | ||
INSERT INTO t1 (f1) VALUES (5),(6); | ||
|
||
# | ||
# With wsrep_retry_autocommit = 1024, success against multiple TRUNCATEs | ||
# | ||
|
||
--connection node_1 | ||
SET SESSION wsrep_retry_autocommit = 1024; | ||
--send INSERT INTO t1 (f1) VALUES (7),(8); | ||
|
||
--sleep 6 | ||
|
||
# Once he stream of TRUNCATEs is complete | ||
--connection node_2 | ||
--reap | ||
|
||
# the INSERT will eventually be sucessfull | ||
--connection node_1 | ||
--error 0 | ||
--reap | ||
|
||
--let $diff_servers = 1 2 | ||
--source include/diff_servers.inc | ||
|
||
DROP TABLE t1; | ||
DROP PROCEDURE repeated_truncate; |
Oops, something went wrong.