summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-03-15 12:55:03 +0200
committerGitHub <noreply@github.com>2018-03-15 12:55:03 +0200
commitff172467ec03b8c1d23ed20ff258953ca158ae6f (patch)
treeef7059160af198ee9cf70f99a5b135835be2fe41
parent047abdac3e0e49d34080644ba0572d6a80b0ccd5 (diff)
parent9a21fd34af0506c5b45133c87c23862b84b36717 (diff)
downloadmariadb-git-ff172467ec03b8c1d23ed20ff258953ca158ae6f.tar.gz
Merge pull request #659 from codership/MDEV-13549-fixes-for-galera_bf_abort_for_update
MDEV-13549 Fix and re-enable test galera.galera_bf_abort_for_update
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_bf_abort_for_update.result23
-rw-r--r--mysql-test/suite/galera/t/galera_bf_abort_for_update.test45
3 files changed, 53 insertions, 16 deletions
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index e70ab112df9..100966a0fe4 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -33,7 +33,6 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures
mysql-wsrep#31 : MDEV-13549 Galera test failures
galera_migrate : MariaDB 10.0 does not support START SLAVE USER
galera_concurrent_ctas : MDEV-13549 Galera test failures
-galera_bf_abort_for_update : MDEV-13549 Galera test failures
galera_wsrep_desync_wsrep_on : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures
mysql-wsrep#33 : MDEV-13549 Galera test failures
diff --git a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
index 3978a3df193..2367924466c 100644
--- a/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
+++ b/mysql-test/suite/galera/r/galera_bf_abort_for_update.result
@@ -1,10 +1,21 @@
-CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1);
-INSERT INTO t1 VALUES (1);
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, 10);
+BEGIN;
SELECT * FROM t1 FOR UPDATE;
+f1 f2
+1 10
+UPDATE t1 SET f1 = 2;
+COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
-wsrep_local_aborts_increment
+wsrep_local_bf_aborts_diff
+1
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
+f1 f2
+2 10
+UPDATE t1 SET f2 = 20;
+COMMIT;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+wsrep_local_bf_aborts_diff
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_bf_abort_for_update.test b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test
index 24c29778e5d..13e48f8f3ce 100644
--- a/mysql-test/suite/galera/t/galera_bf_abort_for_update.test
+++ b/mysql-test/suite/galera/t/galera_bf_abort_for_update.test
@@ -5,25 +5,52 @@
# Test a local transaction being aborted by a slave one while it is running a SELECT FOR UPDATE
#
-CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INT) ENGINE=InnoDB;
---connection node_2
---let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (1, 10);
+
+# Test updating the PK
--connection node_1
-INSERT INTO t1 VALUES (1);
+--let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
+BEGIN;
+SELECT * FROM t1 FOR UPDATE;
--connection node_2
+UPDATE t1 SET f1 = 2;
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f1 = 2
+--source include/wait_condition.inc
+
+--connection node_1
--error ER_LOCK_DEADLOCK
+COMMIT;
+
+--disable_query_log
+--eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
+--enable_query_log
+
+# Test updating non-indexed column
+
+--connection node_1
+--let $wsrep_local_bf_aborts_before = `SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'`
+BEGIN;
SELECT * FROM t1 FOR UPDATE;
---let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
+--connection node_2
+UPDATE t1 SET f2 = 20;
+
+--connection node_1a
+--let $wait_condition = SELECT COUNT(*) FROM t1 WHERE f2 = 20
+--source include/wait_condition.inc
+
+--connection node_1
+--error ER_LOCK_DEADLOCK
+COMMIT;
--disable_query_log
---eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
+--eval SELECT variable_value - $wsrep_local_bf_aborts_before AS wsrep_local_bf_aborts_diff FROM information_schema.global_status WHERE variable_name = 'wsrep_local_bf_aborts'
--enable_query_log
DROP TABLE t1;