1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00
Files
mariadb/mysql-test/suite/galera/t/MW-328A.test
2020-07-24 12:05:39 +03:00

83 lines
1.7 KiB
Plaintext

#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# test phase 1 is not deterministic
#
# Here we attempt to insert into t2 and check if insert actually
# inserted rows if a success was reported.
#
# However, deadlocks may or may not happen in this test execution
# it all depends on timing.
#
--source include/galera_cluster.inc
--source include/force_restart.inc
--source suite/galera/t/MW-328-header.inc
--connection node_1
call mtr.add_suppression("WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position");
--connection node_2
call mtr.add_suppression("WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position");
--let $count = 100
--let $successes = 0
--let $deadlocks = 0
SET SESSION wsrep_retry_autocommit = 0;
--disable_query_log
while ($count)
{
TRUNCATE TABLE t2;
--error 0,ER_LOCK_DEADLOCK
INSERT IGNORE INTO t2 SELECT f2 FROM t1;
if ($mysql_errno != 1213) {
--inc $successes
if (`SELECT COUNT(*) = 0 FROM t2`) {
--die No rows arrived in table t2
}
}
if ($mysql_errno == 1213) {
--inc $deadlocks
}
--dec $count
}
--enable_query_log
--source suite/galera/t/MW-328-footer.inc
#
# Test phase 2 is deterministic
# Here we generate a sure conflict in node 1 and verify that
# insert failed in both nodes
#
--connection node_1
CREATE TABLE t1 (i int primary key, j int) engine=innodb;
INSERT INTO t1 values (1,0);
BEGIN;
UPDATE t1 SET j=1 WHERE i=1;
--connection node_2
UPDATE t1 SET j=2 WHERE i=1;
--connection node_1
--error ER_LOCK_DEADLOCK
COMMIT;
SELECT * FROM t1;
--connection node_2
SELECT * FROM t1;
--connection node_1
DROP TABLE t1;