summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/galera_sr
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result33
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-25718.test5
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test68
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test4
4 files changed, 106 insertions, 4 deletions
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result
new file mode 100644
index 00000000..a1495f1c
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort_idle.result
@@ -0,0 +1,33 @@
+connection node_2;
+connection node_1;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1);
+SET SESSION wsrep_trx_fragment_size=10;
+SET SESSION wsrep_trx_fragment_unit='rows';
+START TRANSACTION;
+UPDATE t1 SET f2 = f2 + 10;
+connection node_2;
+INSERT INTO t1 VALUES (10,2);
+connection node_1a;
+connection node_1;
+INSERT INTO t1 VALUES (9,1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+DROP TABLE t1;
+connection node_1;
+CREATE TABLE t1(f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1);
+SET SESSION wsrep_trx_fragment_size=5;
+SET SESSION wsrep_trx_fragment_unit='rows';
+START TRANSACTION;
+UPDATE t1 SET f2 = f2 + 10;
+connection node_2;
+INSERT INTO t1 VALUES (10,2);
+connection node_1a;
+connection node_1;
+INSERT INTO t1 VALUES (9,1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/MDEV-25718.test b/mysql-test/suite/galera_sr/t/MDEV-25718.test
index 9aebbdc7..037cd300 100644
--- a/mysql-test/suite/galera_sr/t/MDEV-25718.test
+++ b/mysql-test/suite/galera_sr/t/MDEV-25718.test
@@ -43,8 +43,9 @@ SET SESSION wsrep_sync_wait = 0;
SET debug_sync = "now SIGNAL write_row_continue";
# Let's give the INSERT some time, to make sure it does rollback
---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = "INSERT INTO t1 VALUES (1)" AND STATE = "Freeing items";
---source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = "INSERT INTO t1 VALUES (1)" AND (STATE = "Freeing items" OR STATE = 'Rollback');
+--let $wait_condition_on_error_output = SELECT INFO, STATE FROM INFORMATION_SCHEMA.PROCESSLIST
+--source include/wait_condition_with_debug.inc
# Resume the DDL in streaming_rollback
SET SESSION debug_sync = "now SIGNAL wsrep_streaming_rollback_continue";
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test
new file mode 100644
index 00000000..66259b79
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort_idle.test
@@ -0,0 +1,68 @@
+#
+# Test BF abort for idle SR transactions
+#
+
+--source include/galera_cluster.inc
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+#
+# Case 1: BF abort idle SR transaction that has not yet replicated any fragments
+#
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1);
+
+--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+SET SESSION wsrep_trx_fragment_size=10;
+SET SESSION wsrep_trx_fragment_unit='rows';
+START TRANSACTION;
+UPDATE t1 SET f2 = f2 + 10;
+
+--connection node_2
+INSERT INTO t1 VALUES (10,2);
+
+# Wait for SR transaction to be BF aborted
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'
+--source include/wait_condition.inc
+
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (9,1);
+ROLLBACK;
+
+DROP TABLE t1;
+
+
+#
+# Case 2: BF abort idle SR transaction that has already replicated a fragment
+#
+--connection node_1
+CREATE TABLE t1(f1 INTEGER PRIMARY KEY, f2 INTEGER);
+INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1);
+
+--let $bf_count = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.global_status WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+
+
+SET SESSION wsrep_trx_fragment_size=5;
+SET SESSION wsrep_trx_fragment_unit='rows';
+START TRANSACTION;
+UPDATE t1 SET f2 = f2 + 10;
+
+--connection node_2
+INSERT INTO t1 VALUES (10,2);
+
+# Wait for SR transaction to be BF aborted
+--connection node_1a
+--let $wait_condition = SELECT VARIABLE_VALUE = $bf_count + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'
+--source include/wait_condition.inc
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+INSERT INTO t1 VALUES (9,1);
+ROLLBACK;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
index 5332b1a1..f6f50fd5 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
@@ -38,12 +38,12 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
---let $start_mysqld_params = "--wsrep-new-cluster"
+--let $start_mysqld_params =--wsrep-new-cluster
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--connection node_2
---let $start_mysqld_params = ""
+--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc