diff options
Diffstat (limited to 'mysql-test/suite/galera_sr')
194 files changed, 9748 insertions, 0 deletions
diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def new file mode 100644 index 00000000000..1d8b79a8fb5 --- /dev/null +++ b/mysql-test/suite/galera_sr/disabled.def @@ -0,0 +1,17 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# <testcasename> : MDEV-<xxxx> <comment> +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + +GCF-1018B : MDEV-21613 galera_sr.GCF-1018B MTR failed: Failed to open table mysql.wsrep_streaming_log for writing +GCF-1043A : MDEV-21170 Galera test failure on galera_sr.GCF-1043A +GCF-1060 : MDEV-20848 galera_sr.GCF_1060 +galera-features#56 : MDEV-18542 galera_sr.galera-features#56 + diff --git a/mysql-test/suite/galera_sr/galera_2nodes.cnf b/mysql-test/suite/galera_sr/galera_2nodes.cnf new file mode 100644 index 00000000000..0412b5654dd --- /dev/null +++ b/mysql-test/suite/galera_sr/galera_2nodes.cnf @@ -0,0 +1 @@ +!include ../galera/galera_2nodes.cnf diff --git a/mysql-test/suite/galera_sr/my.cnf b/mysql-test/suite/galera_sr/my.cnf new file mode 100644 index 00000000000..ca163a540d9 --- /dev/null +++ b/mysql-test/suite/galera_sr/my.cnf @@ -0,0 +1 @@ +!include galera_2nodes.cnf diff --git a/mysql-test/suite/galera_sr/r/GCF-1008.result b/mysql-test/suite/galera_sr/r/GCF-1008.result new file mode 100644 index 00000000000..f55f6f33f3e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1008.result @@ -0,0 +1,70 @@ +connection node_2; +connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'x'); +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_local_commit_monitor_enter'; +connection node_2; +COMMIT; +connection node_2b; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +connection node_1; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +REPLACE INTO t1 VALUES (1,'y'); +connection node_2b; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +connection node_2a; +SET GLOBAL wsrep_provider_options = 'signal=before_local_commit_monitor_enter'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_2; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'x'); +connection node_2a; +SET GLOBAL wsrep_provider_options = 'dbug=d,before_certify_apply_monitor_enter'; +connection node_2; +COMMIT; +connection node_2b; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +connection node_1; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +REPLACE INTO t1 VALUES (1,'y'); +connection node_2b; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +connection node_2a; +SET GLOBAL wsrep_provider_options = 'signal=before_certify_apply_monitor_enter'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_2; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-1018.result b/mysql-test/suite/galera_sr/r/GCF-1018.result new file mode 100644 index 00000000000..12a4d3c70af --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1018.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +INSERT INTO t1 (f2) VALUES ('a'); +INSERT INTO t1 (f2) VALUES ('b'); +INSERT INTO t1 (f2) VALUES ('c'); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_certify_apply_monitor_enter'; +connection node_2; +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_trx_fragment_size = 64; +DELETE FROM t1 ORDER BY f1 DESC LIMIT 2;; +connection node_2a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +connection node_1; +INSERT INTO t1 (f2) VALUES ('d'),('e'); +connection node_2a; +SET GLOBAL wsrep_provider_options = 'signal=after_certify_apply_monitor_enter'; +SET GLOBAL wsrep_provider_options = 'dbug='; +connection node_2; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-1018B.result b/mysql-test/suite/galera_sr/r/GCF-1018B.result new file mode 100644 index 00000000000..4752c072cc1 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1018B.result @@ -0,0 +1,12 @@ +connection node_2; +connection node_1; +connection node_1; +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 64; +SET SESSION innodb_lock_wait_timeout = 1000; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 64; +SET SESSION innodb_lock_wait_timeout = 1000; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-1043A.result b/mysql-test/suite/galera_sr/r/GCF-1043A.result new file mode 100644 index 00000000000..cc90461291d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1043A.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +Running a concurrent test with the following queries: +DELETE FROM t1 +REPLACE INTO t1 VALUES (1,'y'),(2,'x') +REPLACE INTO t1 VALUES (1,'y'),(2,'y'),(3,'y') +connection node_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +include/diff_servers.inc [servers=1 2] +DROP TABLE t1; +Concurrent test end diff --git a/mysql-test/suite/galera_sr/r/GCF-1043B.result b/mysql-test/suite/galera_sr/r/GCF-1043B.result new file mode 100644 index 00000000000..a10295c00b9 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1043B.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +Running a concurrent test with the following queries: +DELETE FROM t1 +INSERT INTO t1 VALUES (1,'y'),(2,'x') +UPDATE t1 SET f2 = 'y' WHERE f1 = 1 OR f1 = 2; +connection node_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +include/diff_servers.inc [servers=1 2] +DROP TABLE t1; +Concurrent test end diff --git a/mysql-test/suite/galera_sr/r/GCF-1051.result b/mysql-test/suite/galera_sr/r/GCF-1051.result new file mode 100644 index 00000000000..82fa389bb1d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1051.result @@ -0,0 +1,46 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size=1; +connection node_1; +START TRANSACTION; +SAVEPOINT A; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT A; +COMMIT; +connection node_1; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=OFF; +SAVEPOINT A; +INSERT INTO t1 VALUES (2); +ROLLBACK TO SAVEPOINT A; +COMMIT; +connection node_1; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-1060.result b/mysql-test/suite/galera_sr/r/GCF-1060.result new file mode 100644 index 00000000000..58af97d064b --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-1060.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +Running a concurrent test with the following queries: +TRUNCATE TABLE t1 +INSERT INTO t1 VALUE (1,'x'),(2,'x'),(3,'x') +INSERT INTO t1 VALUE (4, 'z'); +connection node_1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1;;; +include/diff_servers.inc [servers=1 2] +DROP TABLE t1; +Concurrent test end diff --git a/mysql-test/suite/galera_sr/r/GCF-561.result b/mysql-test/suite/galera_sr/r/GCF-561.result new file mode 100644 index 00000000000..ec5ec786628 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-561.result @@ -0,0 +1,52 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log; +EXPECT_5 +5 +ALTER TABLE t1 DROP COLUMN f2; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +connection node_1; +INSERT INTO t1 VALUES (6, 6); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +INSERT INTO t1 VALUES (6, 6); +ERROR 21S01: Column count doesn't match value count at row 1 +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +COMMIT; +connection node_2; +set global wsrep_sync_wait=15; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) AS EXPECT_5 FROM t1; +EXPECT_5 +5 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-571.result b/mysql-test/suite/galera_sr/r/GCF-571.result new file mode 100644 index 00000000000..fd20afd7e6e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-571.result @@ -0,0 +1,67 @@ +connection node_2; +connection node_1; +SET AUTOCOMMIT=OFF; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +SAVEPOINT A; +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; +COUNT(*) = 1 +1 +connection node_1; +ROLLBACK TO SAVEPOINT A; +connection node_1a; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%'; +COUNT(*) = 1 +0 +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%'; +COUNT(*) = 1 +0 +connection node_1; +ROLLBACK; +connection node_1a; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-572.result b/mysql-test/suite/galera_sr/r/GCF-572.result new file mode 100644 index 00000000000..cb4d48b3600 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-572.result @@ -0,0 +1,37 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'node1'); +connection node_1a; +INSERT INTO t1 VALUES (5, 'node2'); +connection node_1; +INSERT INTO t1 VALUES (5, 'node1'); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM t1; +f1 f2 +5 node2 +SET SESSION wsrep_trx_fragment_size = 10000; +START TRANSACTION; +INSERT INTO t1 VALUE (10, 'node1'); +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +connection node_1a; +INSERT INTO t1 VALUES(15, 'node2'); +connection node_1; +SELECT * FROM t1; +f1 f2 +5 node2 +10 node1 +INSERT INTO t1 VALUES(15, 'node1'); +ERROR 23000: Duplicate entry '15' for key 'PRIMARY' +COMMIT; +SELECT * FROM t1; +f1 f2 +5 node2 +10 node1 +15 node2 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-580.result b/mysql-test/suite/galera_sr/r/GCF-580.result new file mode 100644 index 00000000000..3ee69c6c4b3 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-580.result @@ -0,0 +1,13 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +last_committed_matches_fragment_count +1 +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-585.result b/mysql-test/suite/galera_sr/r/GCF-585.result new file mode 100644 index 00000000000..ab5fed59081 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-585.result @@ -0,0 +1,28 @@ +connection node_2; +connection node_1; +create table t1 (f1 integer primary key) engine=innodb; +set autocommit=off; +set session wsrep_trx_fragment_size=1; +start transaction; +insert into t1 values (1); +insert into t1 values (2),(1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +alter table t1 drop primary key; +drop table t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +update t1 set f1 = 100 where f1 = 10; +connection node_2; +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +SET SESSION wsrep_trx_fragment_size=1; +SET SESSION innodb_lock_wait_timeout=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +delete from t1 where f1 > 10; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +delete from t1 where f1 > 10 and f1 < 100; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-597.result b/mysql-test/suite/galera_sr/r/GCF-597.result new file mode 100644 index 00000000000..7afca229251 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-597.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_1; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +ROLLBACK; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-620.result b/mysql-test/suite/galera_sr/r/GCF-620.result new file mode 100644 index 00000000000..02cb163a199 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-620.result @@ -0,0 +1,18 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 200; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (1); +SAVEPOINT A; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT A; +COMMIT; +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-623.result b/mysql-test/suite/galera_sr/r/GCF-623.result new file mode 100644 index 00000000000..f3500b7ac2b --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-623.result @@ -0,0 +1,29 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-627.result b/mysql-test/suite/galera_sr/r/GCF-627.result new file mode 100644 index 00000000000..891cf4af5a9 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-627.result @@ -0,0 +1,26 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER); +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +connection node_2; +DROP TABLE t1; +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +INSERT INTO t1 VALUES (2); +ERROR 42S02: Table 'test.t1' doesn't exist +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/r/GCF-845.result b/mysql-test/suite/galera_sr/r/GCF-845.result new file mode 100644 index 00000000000..df842049332 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-845.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +CREATE TABLE IF NOT EXISTS t1 (f1 INTEGER) ENGINE = InnoDB; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (161); +COMMIT; +DELETE FROM t1 WHERE f1 > 13; +disconnect node_1a; +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; +include/assert_grep.inc [No BF-BF log line found] diff --git a/mysql-test/suite/galera_sr/r/GCF-851.result b/mysql-test/suite/galera_sr/r/GCF-851.result new file mode 100644 index 00000000000..52aa4c78745 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-851.result @@ -0,0 +1,30 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION WSREP_TRX_FRAGMENT_SIZE=1; +SET SESSION AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (10); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +START TRANSACTION; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1; +COUNT(*) > 0 +1 +connection node_1; +SELECT COUNT(*) > 0 FROM t1; +COUNT(*) > 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-867.result b/mysql-test/suite/galera_sr/r/GCF-867.result new file mode 100644 index 00000000000..9521a86d621 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-867.result @@ -0,0 +1,4 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-889.result b/mysql-test/suite/galera_sr/r/GCF-889.result new file mode 100644 index 00000000000..617377de15a --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-889.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +connection node_2; +SET GLOBAL wsrep_ignore_apply_errors = 2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_on = OFF; +INSERT INTO t1 VALUES (1); +SET SESSION wsrep_on = ON; +SET SESSION wsrep_trx_fragment_size = 1; +DELETE FROM t1 WHERE f1 = 1; +SET SESSION wsrep_trx_fragment_size = 0; +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) = 1; +COUNT(*) = 1 +1 +connection node_2; +SELECT COUNT(*) = 1; +COUNT(*) = 1 +1 +CALL mtr.add_suppression("Could not execute Delete_rows event on table"); +CALL mtr.add_suppression("Can't find record in 't1'"); +SET GLOBAL wsrep_ignore_apply_errors = 7; +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/GCF-900.result b/mysql-test/suite/galera_sr/r/GCF-900.result new file mode 100644 index 00000000000..caa2d2c4138 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/GCF-900.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 128; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 0); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (2, 0); +connection node_2; +ALTER TABLE t1 DROP COLUMN f2; +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1a; +INSERT INTO t1 VALUES (3, 0); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/MDEV-18585.result b/mysql-test/suite/galera_sr/r/MDEV-18585.result new file mode 100644 index 00000000000..d30def1ea63 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-18585.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INT PRIMARY KEY); +SET SESSION wsrep_trx_fragment_unit='ROWS'; +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES (1), (2); +SET SESSION wsrep_trx_fragment_unit='BYTES'; +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES (3), (4); +SET SESSION wsrep_trx_fragment_unit='STATEMENTS'; +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES (5), (6); +SET SESSION wsrep_trx_fragment_unit=default; +SET SESSION wsrep_trx_fragment_size=default; +SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000002 518 Gtid 1 560 BEGIN GTID 0-1-2 +mysqld-bin.000002 560 Annotate_rows 1 613 INSERT INTO t1 VALUES (1), (2) +mysqld-bin.000002 613 Table_map 1 658 table_id: # (test.t1) +mysqld-bin.000002 658 Write_rows_v1 1 696 table_id: # flags: STMT_END_F +mysqld-bin.000002 696 Table_map 1 741 table_id: # (test.t1) +mysqld-bin.000002 741 Write_rows_v1 1 779 table_id: # flags: STMT_END_F +mysqld-bin.000002 779 Xid 1 810 COMMIT /* xid=# */ +mysqld-bin.000002 810 Gtid 1 852 BEGIN GTID 0-1-3 +mysqld-bin.000002 852 Annotate_rows 1 905 INSERT INTO t1 VALUES (3), (4) +mysqld-bin.000002 905 Table_map 1 950 table_id: # (test.t1) +mysqld-bin.000002 950 Write_rows_v1 1 988 table_id: # flags: STMT_END_F +mysqld-bin.000002 988 Table_map 1 1033 table_id: # (test.t1) +mysqld-bin.000002 1033 Write_rows_v1 1 1071 table_id: # flags: STMT_END_F +mysqld-bin.000002 1071 Xid 1 1102 COMMIT /* xid=# */ +mysqld-bin.000002 1102 Gtid 1 1144 BEGIN GTID 0-1-4 +mysqld-bin.000002 1144 Annotate_rows 1 1197 INSERT INTO t1 VALUES (5), (6) +mysqld-bin.000002 1197 Table_map 1 1242 table_id: # (test.t1) +mysqld-bin.000002 1242 Write_rows_v1 1 1285 table_id: # flags: STMT_END_F +mysqld-bin.000002 1285 Xid 1 1316 COMMIT /* xid=# */ +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/MDEV-22616.result b/mysql-test/suite/galera_sr/r/MDEV-22616.result new file mode 100644 index 00000000000..0c3847bd9b9 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-22616.result @@ -0,0 +1,13 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +START TRANSACTION; +INSERT INTO t1 VALUES (1); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera-features#56.result b/mysql-test/suite/galera_sr/r/galera-features#56.result new file mode 100644 index 00000000000..a4264739cbf --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera-features#56.result @@ -0,0 +1,38 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +connection node_1; +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) Engine=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +connection node_2; +set session wsrep_sync_wait=15; +SELECT COUNT(*) from ten; +COUNT(*) +10 +SELECT COUNT(*) from t1; +COUNT(*) +0 +set session wsrep_sync_wait=0; +SET GLOBAL wsrep_slave_threads = 4; +SET SESSION wsrep_trx_fragment_size = 1; +connection node_1; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_1a; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_2; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; +connection node_1; +connection node_1a; +connection node_2; +set session wsrep_sync_wait=15; +SELECT COUNT(*) FROM t1; +COUNT(*) +30000 +SELECT COUNT(DISTINCT f1) FROM t1; +COUNT(DISTINCT f1) +30000 +connection default; +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result new file mode 100644 index 00000000000..bf92a48b242 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_bf_abort.result @@ -0,0 +1,555 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait = 0; +galera_sr_bf_abort_at_commit = 0 +after_replicate_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; +connection node_1; +INSERT INTO t1 VALUES (3); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +local_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +connection node_1; +INSERT INTO t1 VALUES (3); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +apply_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; +connection node_1; +INSERT INTO t1 VALUES (3); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +commit_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +connection node_1; +INSERT INTO t1 VALUES (3); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +galera_sr_bf_abort_at_commit = 1 +after_replicate_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; +connection node_1; +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +local_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; +connection node_1; +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +apply_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; +connection node_1; +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +commit_monitor_master_enter_sync +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; +f1 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +connection node_1; +ROLLBACK; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_2; +SELECT * FROM t1; +f1 +1 +2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; +DROP TABLE t1; +CALL mtr.add_suppression("WSREP: fragment replication failed: 1"); diff --git a/mysql-test/suite/galera_sr/r/galera_sr_blob.result b/mysql-test/suite/galera_sr/r/galera_sr_blob.result new file mode 100644 index 00000000000..db25f54a611 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_blob.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 TEXT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_2; +connection node_1; +INSERT INTO t1 VALUES (REPEAT('x', 65535)); +connection node_2; +wsrep_last_committed_delta +1 +connection node_1; +COMMIT; +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT LENGTH(f1) = 65535 FROM t1; +LENGTH(f1) = 65535 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result new file mode 100644 index 00000000000..9e223414fe4 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result @@ -0,0 +1,66 @@ +connection node_2; +connection node_1; +CALL mtr.add_suppression("WSREP: discarding established.*"); +connection node_1; +connection node_2; +connection node_2; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +connection node_1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_cluster_address = ''; +SET SESSION wsrep_sync_wait = DEFAULT; +connection node_2; +INSERT INTO t1 VALUES (6); +ERROR HY000: Lost connection to MySQL server during query +connection node_1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +connection node_2a; +connection node_1; +connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2b; +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +COMMIT; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +connection node_1; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +DROP TABLE t1; +connection node_2b; +CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for"); +disconnect node_2; +connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_no_primary.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_no_primary.result new file mode 100644 index 00000000000..982d8b3aefe --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_no_primary.result @@ -0,0 +1,70 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_1; +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +connection node_2; +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +SELECT COUNT(*) `expect 6` FROM mysql.wsrep_streaming_log; +expect 6 +6 +connection node_2a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SET SESSION wsrep_sync_wait = DEFAULT; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 1 +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SET SESSION wsrep_sync_wait = DEFAULT; +connection node_2a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +connection node_1a; +SHOW STATUS LIKE 'wsrep_cluster_size'; +Variable_name Value +wsrep_cluster_size 2 +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +connection node_2a; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +INSERT INTO t1 VALUES(10); +INSERT INTO t1 VALUES(20); +SELECT * FROM t1; +f1 +10 +20 +connection node_1; +INSERT INTO t1 VALUES(13); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2; +INSERT INTO t1 VALUES(23); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result new file mode 100644 index 00000000000..d439380e2ce --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result @@ -0,0 +1,61 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SET GLOBAL wsrep_cluster_address = ''; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_sync_wait = default; +connection node_1; +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (10); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (16); +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; +CALL mtr.add_suppression("points to own listening address, blacklisting"); diff --git a/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result b/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result new file mode 100644 index 00000000000..75acba366c2 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_concurrent.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +connection node_1; +COMMIT; +connection node_1a; +COMMIT; +connection node_2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SELECT COUNT(*) = 5 FROM t2; +COUNT(*) = 5 +1 +connection node_1; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict.result new file mode 100644 index 00000000000..a45bffeaa81 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +INSERT INTO t1 VALUES(1);; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_1; +COMMIT; +connection node_2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result new file mode 100644 index 00000000000..5de1ac2422c --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit.result @@ -0,0 +1,31 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_1; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +COMMIT; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result new file mode 100644 index 00000000000..2ee3d4c714c --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_on_commit2.result @@ -0,0 +1,28 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_1; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +INSERT INTO t1 VALUES (5);; +connection node_1; +COMMIT; +connection node_2; +ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result b/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result new file mode 100644 index 00000000000..92bf007e21b --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_conflict_with_rollback_master.result @@ -0,0 +1,29 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_1; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +ROLLBACK; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result b/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result new file mode 100644 index 00000000000..c8658f09ff0 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_create_drop.result @@ -0,0 +1,28 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size=1; +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` int(11) NOT NULL, + PRIMARY KEY (`f1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +connection node_1; +DROP TABLE t1; +connection node_2; +SHOW CREATE TABLE t1; +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE DATABASE mdev_18587; +connection node_2; +SHOW DATABASES LIKE 'mdev_18587'; +Database (mdev_18587) +mdev_18587 +connection node_1; +DROP DATABASE mdev_18587; +connection node_2; +SHOW DATABASES LIKE 'mdev_18587'; +Database (mdev_18587) +connection node_1; +SET SESSION wsrep_trx_fragment_size=DEFAULT; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result new file mode 100644 index 00000000000..5858a9c6eb8 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result @@ -0,0 +1,65 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log; +expect_5 +5 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_1; +INSERT INTO t1 VALUES (6); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +ROLLBACK; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES (1); +INSERT INTO t1 (f1) VALUES (2); +INSERT INTO t1 (f1) VALUES (3); +INSERT INTO t1 (f1) VALUES (4); +INSERT INTO t1 (f1) VALUES (5); +INSERT INTO t1 (f1) VALUES (6); +COMMIT; +SELECT COUNT(*) as expect_6 FROM t1; +expect_6 +6 +SELECT * FROM t1; +f1 f2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +6 NULL +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +connection node_2; +SELECT COUNT(*) as expect_6 FROM t1; +expect_6 +6 +SELECT * FROM t1; +f1 f2 +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +6 NULL +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result new file mode 100644 index 00000000000..fcd6cfa4a6e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_schema.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +DROP SCHEMA test; +SELECT COUNT(*) = 0 FROM test.t1; +ERROR 42S02: Table 'test.t1' doesn't exist +connection node_1; +INSERT INTO test.t1 VALUES (6, 6); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +INSERT INTO test.t1 VALUES (6, 6); +ERROR 42S02: Table 'test.t1' doesn't exist +CREATE SCHEMA test; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result new file mode 100644 index 00000000000..58663caf134 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_slave.result @@ -0,0 +1,50 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +ALTER TABLE t1 DROP COLUMN f2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +INSERT INTO t1 VALUES (6, 6); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (6, 6); +ERROR 21S01: Column count doesn't match value count at row 1 +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +COMMIT; +connection node_2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result new file mode 100644 index 00000000000..0f23ade58c1 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_unrelated.result @@ -0,0 +1,42 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +ALTER TABLE t2 DROP COLUMN f2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +INSERT INTO t1 VALUES (6, 6); +connection node_2; +connection node_1; +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 6 FROM t1; +COUNT(*) = 6 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result b/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result new file mode 100644 index 00000000000..b23b934da33 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_dupkey_error.result @@ -0,0 +1,46 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB; +CREATE UNIQUE INDEX i1 ON t1 (f1(512)); +SET AUTOCOMMIT=OFF; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1024; +INSERT INTO t1 VALUES (REPEAT('a', 512)); +INSERT INTO t1 VALUES (REPEAT('b', 512)); +INSERT INTO t1 VALUES (REPEAT('c', 512)); +INSERT INTO t1 VALUES (REPEAT('d', 512)); +INSERT INTO t1 VALUES (REPEAT('e', 512)); +INSERT INTO t1 VALUES (REPEAT('f', 512)); +connection node_2; +connection node_1; +INSERT INTO t1 VALUES (REPEAT('c', 512)); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +INSERT INTO t1 VALUES (REPEAT('d', 512)); +INSERT INTO t1 VALUES (REPEAT('e', 512)); +INSERT INTO t1 VALUES (REPEAT('f', 512)); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (REPEAT('a', 512)); +INSERT INTO t1 VALUES (REPEAT('b', 512)); +INSERT INTO t1 VALUES (REPEAT('c', 512)); +COMMIT; +connection node_1; +SELECT COUNT(*) = 6 FROM t1; +COUNT(*) = 6 +1 +connection node_2; +SELECT COUNT(*) = 6 FROM t1; +COUNT(*) = 6 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result b/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result new file mode 100644 index 00000000000..1d12533cc1d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_fk_conflict.result @@ -0,0 +1,39 @@ +connection node_2; +connection node_1; +CREATE TABLE grandparent ( +id INT NOT NULL PRIMARY KEY +) ENGINE=InnoDB; +CREATE TABLE parent ( +id INT NOT NULL PRIMARY KEY, +grandparent_id INT, +FOREIGN KEY (grandparent_id) +REFERENCES grandparent(id) +ON UPDATE CASCADE +) ENGINE=InnoDB; +CREATE TABLE child ( +id INT NOT NULL PRIMARY KEY, +grandparent_id INT, +FOREIGN KEY (grandparent_id) +REFERENCES parent(grandparent_id) +ON UPDATE CASCADE +) ENGINE=InnoDB; +INSERT INTO grandparent VALUES (1),(2),(3),(4); +INSERT INTO parent VALUES (1,1), (2,2); +INSERT INTO child VALUES (1,1), (2,2); +connection node_1; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +UPDATE grandparent SET id = 5 WHERE id = 1; +connection node_2; +SET SESSION innodb_lock_wait_timeout = 1; +UPDATE grandparent SET id = 10 WHERE id = 5; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DELETE FROM child; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection node_1; +COMMIT; +include/diff_servers.inc [servers=1 2] +DROP TABLE child; +DROP TABLE parent; +DROP TABLE grandparent; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_gtid.result b/mysql-test/suite/galera_sr/r/galera_sr_gtid.result new file mode 100644 index 00000000000..be631d1d916 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_gtid.result @@ -0,0 +1,57 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INT PRIMARY KEY); +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES (1); +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SET SESSION wsrep_trx_fragment_size=1; +UPDATE t1 SET f1 = 2; +connection node_1; +SET SESSION wsrep_trx_fragment_size=0; +connection node_2; +SET SESSION wsrep_trx_fragment_size=0; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000002 <Pos> Gtid_list 1 <End_log_pos> [] +mysqld-bin.000002 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001 +mysqld-bin.000002 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000002 +mysqld-bin.000002 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1 +mysqld-bin.000002 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INT PRIMARY KEY) +mysqld-bin.000002 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000002 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1) +mysqld-bin.000002 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000002 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000002 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000002 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3 +mysqld-bin.000002 <Pos> Annotate_rows 2 <End_log_pos> UPDATE t1 SET f1 = 2 +mysqld-bin.000002 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000002 <Pos> Update_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000002 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +connection node_2; +SELECT 1 FROM DUAL; +1 +1 +SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000003 <Pos> Gtid_list 2 <End_log_pos> [] +mysqld-bin.000003 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000003 +mysqld-bin.000003 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1 +mysqld-bin.000003 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INT PRIMARY KEY) +mysqld-bin.000003 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000003 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1) +mysqld-bin.000003 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000003 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000003 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000003 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3 +mysqld-bin.000003 <Pos> Annotate_rows 2 <End_log_pos> UPDATE t1 SET f1 = 2 +mysqld-bin.000003 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000003 <Pos> Update_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000003 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result b/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result new file mode 100644 index 00000000000..0302290123d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_insert_select.result @@ -0,0 +1,18 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +COMMIT; +connection node_2; +connection node_1; +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result new file mode 100644 index 00000000000..45ca6909f29 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_nobootstrap.result @@ -0,0 +1,31 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +Killing server ... +connection node_1; +Killing server ... +connection node_1; +# restart +connection node_2; +# restart +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result new file mode 100644 index 00000000000..7ef86c65915 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result @@ -0,0 +1,35 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +connection node_2; +Killing server ... +connection node_1; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +# restart +connection node_2; +# restart +connection node_1; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) `expect 0` FROM t1; +expect 0 +0 +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result new file mode 100644 index 00000000000..7731c19e4da --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_pcrecovery.result @@ -0,0 +1,32 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +Killing server ... +connection node_1; +Killing server ... +connection node_1; +# restart +connection node_2; +# restart +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result new file mode 100644 index 00000000000..96a85bc038b --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_connection.result @@ -0,0 +1,32 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +COMMIT; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_1a; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result new file mode 100644 index 00000000000..82f41a2faaa --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_query.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +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; +INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;; +connection node_2; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +Killing query ... +connection node_1; +ERROR 70100: Query execution was interrupted +connection node_2; +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3; +SELECT COUNT(*) AS EXPECT_1000 FROM t1; +EXPECT_1000 +1000 +connection node_1a; +SET GLOBAL wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_1000 FROM t1; +EXPECT_1000 +1000 +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result new file mode 100644 index 00000000000..d14de27d2b7 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_slave.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +CREATE TABLE t2 (f1 INTEGER); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +LOCK TABLE t2 WRITE; +connection node_1; +INSERT INTO t2 VALUES (1); +connection node_2; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +Killing server ... +connection node_1; +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (10); +connection node_2; +# restart +connection node_1; +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (15); +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 15 FROM t1; +COUNT(*) = 15 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result b/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result new file mode 100644 index 00000000000..bf111f5cee4 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_large_fragment.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +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 PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1024 * 1024 * 10; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 50000 FROM t1; +COUNT(*) > 50000 +1 +connection node_1; +ROLLBACK; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +COUNT(*) = 0 +1 +COUNT(*) = 0 +1 diff --git a/mysql-test/suite/galera_sr/r/galera_sr_load_data.result b/mysql-test/suite/galera_sr/r/galera_sr_load_data.result new file mode 100644 index 00000000000..99885b42fa0 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_load_data.result @@ -0,0 +1,14 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 512; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +connection node_1; +connection node_2; +SELECT COUNT(*) = 20000 FROM t1; +COUNT(*) = 20000 +1 +wsrep_last_committed_diff +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result b/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result new file mode 100644 index 00000000000..61e4b56aa43 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_load_data_splitting.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 512; +SET GLOBAL wsrep_load_data_splitting = TRUE; +Warnings: +Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_2; +connection node_1; +connection node_2; +SELECT COUNT(*) = 95000 FROM t1; +COUNT(*) = 95000 +1 +wsrep_last_committed_diff +1 +connection node_1; +Warnings: +Warning 1287 '@@wsrep_load_data_splitting' is deprecated and will be removed in a future release +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result b/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result new file mode 100644 index 00000000000..cb8e84383bc --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_log_bin.result @@ -0,0 +1,124 @@ +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB; +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t2 VALUES (1); +connection node_2; +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t3 VALUES (1); +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t4 VALUES (1); +connection node_1; +INSERT INTO t1 VALUES (2); +COMMIT; +connection node_1a; +INSERT INTO t2 VALUES (2); +COMMIT; +connection node_2; +INSERT INTO t3 VALUES (2); +COMMIT; +connection node_2a; +INSERT INTO t4 VALUES (2); +COMMIT; +connection node_1; +SELECT COUNT(*) = 2 FROM t4; +COUNT(*) = 2 +1 +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> [] +mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001 +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-1 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3 +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-4 +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +connection node_2; +SELECT COUNT(*) = 2 FROM t4; +COUNT(*) = 2 +1 +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 <Pos> Gtid_list 2 <End_log_pos> [] +mysqld-bin.000001 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000001 +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-1 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t2 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t2) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-3 +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t3 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t3) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 2 <End_log_pos> BEGIN GTID 0-2-4 +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (1) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Annotate_rows 2 <End_log_pos> INSERT INTO t4 VALUES (2) +mysqld-bin.000001 <Pos> Table_map 2 <End_log_pos> table_id: ### (test.t4) +mysqld-bin.000001 <Pos> Write_rows_v1 2 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 2 <End_log_pos> COMMIT /* xid=### */ +DROP TABLE t1,t2,t3,t4; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result b/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result new file mode 100644 index 00000000000..8c89d100260 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_many_fragments.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +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 PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 10000 FROM t1; +COUNT(*) = 10000 +1 +connection node_1; +ROLLBACK; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +COUNT(*) = 0 +1 +COUNT(*) = 0 +1 diff --git a/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result b/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result new file mode 100644 index 00000000000..1795d16bbfa --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_multirow_rollback.result @@ -0,0 +1,127 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +COMMIT; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +connection node_2; +expect (1,'a'), (2, 'b') +SELECT * FROM t1; +f1 f2 +1 a +2 b +DROP TABLE t1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1000; +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM t1; +expect_0 +0 +DROP TABLE t1; +connection node_1; +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +INSERT INTO c VALUES (1,1), (2,2); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +connection node_2; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +DROP TABLE c; +DROP TABLE p; +connection node_1; +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); +SET SESSION wsrep_trx_fragment_size=1000; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +INSERT INTO c VALUES (1,1), (2,2); +ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`c`, CONSTRAINT `c_ibfk_1` FOREIGN KEY (`fk1`) REFERENCES `p` (`id`)) +COMMIT; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +connection node_2; +SELECT * FROM p; +id j +1 0 +SELECT * FROM c; +id fk1 +3 1 +DROP TABLE c; +DROP TABLE p; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result new file mode 100644 index 00000000000..97818f072e1 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result @@ -0,0 +1,16 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM; +SET SESSION wsrep_trx_fragment_size = 1; +SET GLOBAL wsrep_replicate_myisam = TRUE; +INSERT INTO t1 VALUES (REPEAT('x', 65535)); +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT LENGTH(f1) = 65535 FROM t1; +LENGTH(f1) = 65535 +1 +DROP TABLE t1; +connection node_1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result b/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result new file mode 100644 index 00000000000..6789990f18e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_mysqldump_sst.result @@ -0,0 +1,60 @@ +connection node_2; +connection node_1; +Setting SST method to mysqldump ... +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127.0.0.1'"); +call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); +connection node_1; +CREATE USER 'sst'; +GRANT ALL PRIVILEGES ON *.* TO 'sst'; +SET GLOBAL wsrep_sst_auth = 'sst:'; +connection node_2; +SET GLOBAL wsrep_sst_method = 'mysqldump'; +connection node_1; +connection node_2; +connection node_1; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 255) FROM ten AS a1, ten AS a2, ten AS a3; +UPDATE t1 SET f2 = REPEAT('y', 255); +connection node_2; +connection node_2; +Shutting down server ... +connection node_1; +connection node_2; +# restart: with restart_parameters +connection node_1; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +UPDATE t1 SET f2 = REPEAT('z', 255); +COMMIT; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 1000 FROM t1; +COUNT(*) = 1000 +1 +SELECT COUNT(*) = 1000 FROM t1 WHERE f2 = REPEAT('z', 255); +COUNT(*) = 1000 +1 +DROP TABLE t1; +DROP TABLE ten; +connection node_1; +SET SESSION wsrep_trx_fragment_size=0; +connection node_1; +CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +DROP USER sst; +connection node_2; +CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); +CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); +CALL mtr.add_suppression("Can't open and lock time zone table"); +CALL mtr.add_suppression("Can't open and lock privilege tables"); +CALL mtr.add_suppression("Info table is not ready to be used"); +CALL mtr.add_suppression("Native table .* has the wrong structure"); +CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist"); diff --git a/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result b/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result new file mode 100644 index 00000000000..e2194e08cb8 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_parallel_apply.result @@ -0,0 +1,37 @@ +connection node_2; +connection node_1; +connection node_2; +SET GLOBAL wsrep_slave_threads = 5; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1);; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2);; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +COMMIT; +connection node_1a; +ROLLBACK; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_1; +DROP TABLE t1; +connection node_2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback.result new file mode 100644 index 00000000000..4b275c6e0b6 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback.result @@ -0,0 +1,42 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); +connection node_2; +connection node_1; +ROLLBACK; +connection node_2; +connection node_1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); +connection node_2; +connection node_1; +COMMIT; +connection node_2; +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result new file mode 100644 index 00000000000..054f7cf2eae --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_retry.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +ROLLBACK; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +COMMIT; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_1; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result new file mode 100644 index 00000000000..9db548c1616 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_savepoint.result @@ -0,0 +1,42 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +SAVEPOINT s1; +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); +connection node_2; +connection node_1; +ROLLBACK TO SAVEPOINT s1; +INSERT INTO t1 VALUES (21, 'c'); +INSERT INTO t1 VALUES (22, 'c'); +INSERT INTO t1 VALUES (23, 'c'); +INSERT INTO t1 VALUES (24, 'c'); +INSERT INTO t1 VALUES (25, 'c'); +connection node_2; +SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'a'; +COUNT(*) = 5 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 5 +1 +connection node_1; +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result b/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result new file mode 100644 index 00000000000..ce3214afe9e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_rollback_statement.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'); +INSERT INTO t2 VALUES (3, 'b'); +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t2 SELECT * FROM t1; +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' +last_committed_diff +3 +connection node_2; +connection node_1; +INSERT INTO t2 VALUES (1, 'c'); +connection node_2; +INSERT INTO t2 VALUES (2, 'c'); +connection node_1; +SELECT * FROM t2; +f1 f2 +1 c +2 c +3 b +connection node_2; +SELECT * FROM t2; +f1 f2 +1 c +2 c +3 b +connection node_1; +SET SESSION wsrep_trx_fragment_size = DEFAULT; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result new file mode 100644 index 00000000000..051b9d6b7ec --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_master.result @@ -0,0 +1,32 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1),(2),(3); +connection node_1; +connection node_2; +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_2; +# restart +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (1),(2),(3); +connection node_1; +SELECT COUNT(*) = 3 FROM t1; +COUNT(*) = 3 +1 +DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for "); diff --git a/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result new file mode 100644 index 00000000000..902aa27d5aa --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_shutdown_slave.result @@ -0,0 +1,46 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (11),(12),(13); +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (21),(22),(23); +connection node_2; +connection node_1; +connection node_1a; +INSERT INTO t1 VALUES (14),(15),(16); +COMMIT; +connection node_2; +# restart +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SELECT COUNT(*) AS EXPECT_6 FROM t1 WHERE f1 IN (11,12,13,14,15,16); +EXPECT_6 +6 +connection node_1b; +INSERT INTO t1 VALUES (24),(25),(26); +COMMIT; +connection node_2; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_12 FROM t1; +EXPECT_12 +12 +connection node_1; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +EXPECT_0 +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result b/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result new file mode 100644 index 00000000000..875f2df5214 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_small_gcache.result @@ -0,0 +1,15 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +SELECT COUNT(*) = 10000 FROM t1; +COUNT(*) = 10000 +1 +connection node_1; +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result b/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result new file mode 100644 index 00000000000..5806ab5558d --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_transaction_replay.result @@ -0,0 +1,121 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait = 0; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; +f1 f2 +2 a +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +wsrep_local_replays +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DELETE FROM t1; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +UPDATE t1 SET f2 = 'x' WHERE f1 = 1; +SET SESSION wsrep_trx_fragment_size = 0; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; +f1 f2 +2 a +connection node_1a; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; +connection node_1; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +wsrep_local_replays +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DELETE FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result b/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result new file mode 100644 index 00000000000..4e3bd52483e --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_unit_statements.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 3; +SET SESSION wsrep_trx_fragment_unit = 'statements'; +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) FROM t1; +COUNT(*) +0 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +connection node_1; +INSERT INTO t1 VALUES (2); +connection node_2; +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +1 +connection node_1; +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +2 +connection node_1; +COMMIT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +connection node_2; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result b/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result new file mode 100644 index 00000000000..ab090e5c2a7 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_v1_row_events.result @@ -0,0 +1,20 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connection node_1; +COMMIT; +SET AUTOCOMMIT=ON; +UPDATE t1 SET f1 = 2 WHERE f1 = 1; +connection node_2; +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result b/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result new file mode 100644 index 00000000000..b7bdd94dd68 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ws_size.result @@ -0,0 +1,36 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +SET SESSION wsrep_trx_fragment_size = 512; +SET GLOBAL wsrep_provider_options='repl.max_ws_size=4096'; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +COMMIT; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) = 100 FROM t1; +COUNT(*) = 100 +1 +DROP TABLE t1; +DROP TABLE ten; +connection node_1; +call mtr.add_suppression('WSREP: transaction size limit.*'); +call mtr.add_suppression('WSREP: rbr write fail.*'); +call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); +call mtr.add_suppression('WSREP: transaction size exceeded.*'); diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result b/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result new file mode 100644 index 00000000000..6bd8b6b8212 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_sr_ws_size2.result @@ -0,0 +1,34 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +SET SESSION wsrep_trx_fragment_size = 256; +SET GLOBAL wsrep_provider_options='repl.max_ws_size=128'; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1, ten AS a2; +Got one of the listed errors +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +DROP TABLE t1; +DROP TABLE ten; +call mtr.add_suppression('WSREP: SR rollback replication failure.*'); +call mtr.add_suppression('WSREP: transaction size limit.*'); +call mtr.add_suppression('WSREP: SR rbr write fail.*'); +call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); +call mtr.add_suppression('WSREP: transaction size exceeded.*'); +call mtr.add_suppression('WSREP: fragment replication failed:'); +call mtr.add_suppression('WSREP: post commit failed for SR rollback'); +call mtr.add_suppression('WSREP: pre_commit for SR rollback returned 2, thd:*'); +call mtr.add_suppression('WSREP: wsrep_rollback failed to send SR ROLLBACK for *'); diff --git a/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result b/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result new file mode 100644 index 00000000000..852208437e5 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/galera_var_ignore_apply_errors_sr.result @@ -0,0 +1,29 @@ +connection node_2; +connection node_1; +connection node_2; +SET GLOBAL wsrep_ignore_apply_errors = 2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (2); +SET GLOBAL wsrep_on = OFF; +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_on = ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (3); +DELETE FROM t1 WHERE f1 = 1; +DELETE FROM t1 WHERE f1 = 2; +COMMIT; +connection node_1; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SET SESSION wsrep_trx_fragment_size = 0; +DROP TABLE t1; +SET GLOBAL wsrep_ignore_apply_errors = 7; +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); +CALL mtr.add_suppression("Can't find record in 't1'"); diff --git a/mysql-test/suite/galera_sr/r/mdev_18631.result b/mysql-test/suite/galera_sr/r/mdev_18631.result new file mode 100644 index 00000000000..bc6c0e48538 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mdev_18631.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +# On node_1 +connection node_1; +CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES (1), (2), (3); +connection node_2; +SELECT * FROM t1; +f1 +1 +2 +3 +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +3 +DROP TABLE t1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result b/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result new file mode 100644 index 00000000000..623bef4c3c4 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep#215.result @@ -0,0 +1,137 @@ +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 AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 2; +SET SESSION wsrep_trx_fragment_unit = 'statements'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_1a; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; +connection node_2; +INSERT INTO t1 VALUES (1); +connection node_1a; +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (1);; +connection node_1a; +connection node_1a; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1a; +SET DEBUG_SYNC = 'RESET'; +connection node_1; +TRUNCATE TABLE t1; +SET SESSION wsrep_trx_fragment_size = 10; +SET SESSION wsrep_trx_fragment_unit = 'bytes'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_1a; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; +connection node_2; +INSERT INTO t1 VALUES (1); +connection node_1a; +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (1); +connection node_1a; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ROLLBACK; +SELECT * FROM t1; +f1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT * FROM t1; +f1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1a; +SET DEBUG_SYNC = 'RESET'; +connection node_1; +TRUNCATE TABLE t1; +SET SESSION wsrep_trx_fragment_size = 200; +SET SESSION wsrep_trx_fragment_unit = 'bytes'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +connection node_1a; +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; +connection node_2; +INSERT INTO t1 VALUES (1); +connection node_1a; +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +connection node_1a; +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1a; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +connection node_2; +CALL mtr.add_suppression("WSREP: Could not find applier context for"); diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result new file mode 100644 index 00000000000..84246a8eed2 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#136.result @@ -0,0 +1,63 @@ +connection node_2; +connection node_1; +connection node_1; +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +connection node_2; +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +COMMIT; +SET SESSION wsrep_trx_fragment_size = 0; +INSERT INTO t1 VALUES (3),(4); +COMMIT; +connection node_1; +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 <Pos> Gtid_list 1 <End_log_pos> [] +mysqld-bin.000001 <Pos> Binlog_checkpoint 1 <End_log_pos> mysqld-bin.000001 +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1 +mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-3 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (3),(4) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +connection node_2; +SELECT COUNT(*) = 4 FROM t1; +COUNT(*) = 4 +1 +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 <Pos> Gtid_list 2 <End_log_pos> [] +mysqld-bin.000001 <Pos> Binlog_checkpoint 2 <End_log_pos> mysqld-bin.000001 +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> GTID 0-1-1 +mysqld-bin.000001 <Pos> Query 1 <End_log_pos> use `test`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-2 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (1),(2) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +mysqld-bin.000001 <Pos> Gtid 1 <End_log_pos> BEGIN GTID 0-1-3 +mysqld-bin.000001 <Pos> Annotate_rows 1 <End_log_pos> INSERT INTO t1 VALUES (3),(4) +mysqld-bin.000001 <Pos> Table_map 1 <End_log_pos> table_id: ### (test.t1) +mysqld-bin.000001 <Pos> Write_rows_v1 1 <End_log_pos> table_id: ### flags: STMT_END_F +mysqld-bin.000001 <Pos> Xid 1 <End_log_pos> COMMIT /* xid=### */ +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result new file mode 100644 index 00000000000..fc9afd6e1e0 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#138.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +connection node_2; +SELECT flags FROM mysql.wsrep_streaming_log; +flags +1 +0 +connection node_1; +ROLLBACK; +INSERT INTO t1 VALUES (3),(4); +connection node_2; +SELECT flags FROM mysql.wsrep_streaming_log; +flags +1 +0 +connection node_1; +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result new file mode 100644 index 00000000000..b09c7d4047a --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#14.result @@ -0,0 +1,12 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +COMMIT; +DROP TABLE t1; +connection node_2; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result new file mode 100644 index 00000000000..98bf13e9d2b --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result @@ -0,0 +1,39 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t2 VALUES (6),(7),(8),(9),(10),(1); +connection node_2; +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL debug_dbug = 'd,sync.wsrep_apply_cb'; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5);; +connection node_1; +INSERT INTO t1 SELECT * FROM t2;; +connection node_1a; +INSERT INTO t1 VALUES (6), (7), (8), (9), (10); +COMMIT; +connection node_1; +Got one of the listed errors +connection node_2; +SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL debug_dbug = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +1 +DROP TABLE t1; +DROP TABLE t2; +SET DEBUG_SYNC = RESET; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result new file mode 100644 index 00000000000..610019e2b48 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#15.result @@ -0,0 +1,11 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (id INT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result new file mode 100644 index 00000000000..8ad3ac63438 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#165.result @@ -0,0 +1,1045 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); +connection node_1a; +START TRANSACTION; +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; +connection node_1b; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1c; +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (3, 'c'); +connection node_2; +SELECT * FROM t1; +f1 f2 +1 x +2 x +4 x +5 x +connection node_1a; +UPDATE t1 SET f2 = 'a' WHERE f1 = 2; +connection node_1; +connection node_1b; +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR wait'; +connection node_1; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1c; +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; +connection node_1a; +COMMIT; +connection node_1b; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_2; +SELECT * FROM t1; +f1 f2 +1 a +2 a +3 x +4 a +5 a +connection node_1; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result new file mode 100644 index 00000000000..1215f3341e7 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#22.result @@ -0,0 +1,35 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_1; +SAVEPOINT s1; +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); +connection node_2; +connection node_1; +ROLLBACK TO SAVEPOINT s1; +INSERT INTO t1 VALUES (21, 'c'); +COMMIT; +connection node_1; +SELECT COUNT(*) = 6 FROM t1; +COUNT(*) = 6 +1 +connection node_2; +SELECT COUNT(*) = 6 FROM t1; +COUNT(*) = 6 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result new file mode 100644 index 00000000000..4cbcd49dd24 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#27.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result new file mode 100644 index 00000000000..ca749a45e9a --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#32.result @@ -0,0 +1,27 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SET AUTOCOMMIT=OFF; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +START TRANSACTION; +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (5); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ROLLBACK; +connection node_1; +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result new file mode 100644 index 00000000000..3f463875eb3 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#35.result @@ -0,0 +1,37 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb'; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2a; +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +connection node_2; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (1);; +connection node_1; +COMMIT; +connection node_2a; +SET GLOBAL debug_dbug = ''; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; +connection node_2; +Got one of the listed errors +ROLLBACK; +DROP TABLE t1; +connection node_2a; +SET DEBUG_SYNC = "RESET"; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result new file mode 100644 index 00000000000..56905c03e10 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#8.result @@ -0,0 +1,39 @@ +connection node_2; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +connection node_1; +CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; +connection node_2; +SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; +COUNT(*) = 13 +1 +connection node_1; +INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +connection node_2; +SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); +COUNT(f2) = 10000 +1 +UPDATE t1 SET f2 = 'abcdefjhk'; +connection node_1; +SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); +COUNT(f2) = 10000 +1 +connection node_2; +DROP TABLE t1; +connection node_1; +CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; +connection node_2; +INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; +connection node_1; +SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz'); +COUNT(f1) = 1000 +1 +UPDATE t1 SET f1 = 'abcdefjhk'; +connection node_2; +SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); +COUNT(f1) = 1000 +1 +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result new file mode 100644 index 00000000000..312c8efc6ef --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#9.result @@ -0,0 +1,21 @@ +connection node_2; +connection node_1; +connection node_1; +SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +connection node_2; +Killing server ... +connection node_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; +# restart +connection node_2a; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +COUNT(*) = 2 +1 +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result new file mode 100644 index 00000000000..17f71213767 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#93.result @@ -0,0 +1,18 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER); +SET SESSION WSREP_TRX_FRAGMENT_SIZE=1; +START TRANSACTION; +SAVEPOINT a; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT a; +INSERT INTO t1 values (2); +COMMIT; +SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result new file mode 100644 index 00000000000..dbe91aad9fd --- /dev/null +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#96.result @@ -0,0 +1,33 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f2 VARCHAR(32)); +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2),(1); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +INSERT INTO t2 VALUES ('abc'); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 1 FROM t2; +COUNT(*) = 1 +1 +connection node_1; +ROLLBACK; +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t2; +COUNT(*) = 0 +1 +connection node_1; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm new file mode 100644 index 00000000000..cc13421d66d --- /dev/null +++ b/mysql-test/suite/galera_sr/suite.pm @@ -0,0 +1,67 @@ +package My::Suite::Galera_sr; + +use lib 'suite'; +use wsrep::common; + +@ISA = qw(My::Suite); + +return wsrep_not_ok() if wsrep_not_ok(); + +push @::global_suppressions, + ( + qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: Could not open saved state file for reading: .*), + qr(WSREP: Could not open state file for reading: .*), + qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Failed to prepare for incremental state transfer:), + qr(WSREP:.*down context.*), + qr(WSREP: Failed to send state UUID:), + qr(WSREP: last inactive check more than .* skipping check), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Quorum: No node with complete state), + qr(WSREP: Initial position was provided by configuration or SST, avoiding override), + qr|WSREP: discarding established \(time wait\) .*|, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr(WSREP: evs::proto.*), + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr(WSREP: no nodes coming from prim view, prim not possible), + qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: user message in state LEAVING), + qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: Resource temporarily unavailable), + qr(WSREP: Maximum writeset size exceeded by .*), + qr(WSREP: transaction size exceeded.*), + qr(WSREP: RBR event .*), + qr(WSREP: Ignoring error for TO isolated action: .*), + qr(WSREP: transaction size limit .*), + qr(WSREP: rbr write fail, .*), + qr(WSREP: .*Backend not supported: foo.*), + qr(WSREP: .*Failed to initialize backend using .*), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: gcs connect failed: Socket type not supported), + qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), + qr(WSREP: .*Failed to open backend connection: -110 .*), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: gcs connect failed: Connection timed out), + qr|WSREP: wsrep::connect\(.*\) failed: 7|, + qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: Could not find peer:), + qr(WSREP: TO isolation failed for: .*), + qr|WSREP: gcs_caused\(\) returned .*|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, + qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr(WSREP: Action message in non-primary configuration from member [0-9]*), + qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), + qr(WSREP: discarding established .*), + qr|WSREP: .*core_handle_uuid_msg.*|, + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, + qr|Query apply failed:*|, + qr(WSREP: Ignoring error*), + qr(WSREP: Failed to remove page file .*), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), + ); + +bless { }; diff --git a/mysql-test/suite/galera_sr/t/GCF-1008.inc b/mysql-test/suite/galera_sr/t/GCF-1008.inc new file mode 100644 index 00000000000..a6351243516 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1008.inc @@ -0,0 +1,38 @@ +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB; + +--connection node_2 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'x'); + +--connection node_2a +--source include/galera_set_sync_point.inc + +--connection node_2 +--send COMMIT + +--connection node_2b +--sleep 1 +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) AS EXPECT_0 FROM t1; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +REPLACE INTO t1 VALUES (1,'y'); + +--connection node_2b +SELECT COUNT(*) AS EXPECT_0 FROM t1; + +--connection node_2a +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_2 +--reap +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc +SELECT COUNT(*) AS EXPECT_1 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-1008.test b/mysql-test/suite/galera_sr/t/GCF-1008.test new file mode 100644 index 00000000000..c6926840bd1 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1008.test @@ -0,0 +1,18 @@ +# +# GCF-1008 SR trx fails to apply because previous trx is not committed yet on applier +# + +--source include/have_debug_sync.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/galera_have_debug_sync.inc + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--let $galera_sync_point = before_local_commit_monitor_enter +--source GCF-1008.inc + +--let $galera_sync_point = before_certify_apply_monitor_enter +--source GCF-1008.inc + diff --git a/mysql-test/suite/galera_sr/t/GCF-1018.test b/mysql-test/suite/galera_sr/t/GCF-1018.test new file mode 100644 index 00000000000..9a184467ebd --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1018.test @@ -0,0 +1,39 @@ +# +# SR: Node hang with one thread waiting in InnoDB +# +--source include/have_debug_sync.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/galera_have_debug_sync.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +INSERT INTO t1 (f2) VALUES ('a'); +INSERT INTO t1 (f2) VALUES ('b'); +INSERT INTO t1 (f2) VALUES ('c'); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = after_certify_apply_monitor_enter +--source include/galera_set_sync_point.inc + +--connection node_2 +SET SESSION wsrep_retry_autocommit = 0; +SET SESSION wsrep_trx_fragment_size = 64; +--send DELETE FROM t1 ORDER BY f1 DESC LIMIT 2; + +--connection node_2a +--source include/galera_wait_sync_point.inc + +--connection node_1 +INSERT INTO t1 (f2) VALUES ('d'),('e'); + +--connection node_2a +--source include/galera_signal_sync_point.inc +--source include/galera_clear_sync_point.inc + +--connection node_2 +--error ER_LOCK_DEADLOCK +--reap + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-1018B.test b/mysql-test/suite/galera_sr/t/GCF-1018B.test new file mode 100644 index 00000000000..f11309080c0 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1018B.test @@ -0,0 +1,40 @@ +# +# SR: Node hang with one thread waiting in InnoDB +# +--source include/galera_cluster.inc +--source include/big_test.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 64; +SET SESSION innodb_lock_wait_timeout = 1000; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_trx_fragment_size = 64; +SET SESSION innodb_lock_wait_timeout = 1000; + +--let $count = 500 +--disable_query_log +while ($count) +{ + --connection node_1 + --send INSERT INTO t1 (f2) VALUES ('abc'),('abc'); + + --connection node_2 + --send DELETE FROM t1 ORDER BY f1 DESC LIMIT 2; + + --connection node_1 + --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY,ER_LOCK_WAIT_TIMEOUT,ER_QUERY_INTERRUPTED + --reap + + --connection node_2 + --error 0,ER_LOCK_DEADLOCK,ER_DUP_ENTRY,ER_LOCK_WAIT_TIMEOUT,ER_QUERY_INTERRUPTED + --reap + + --dec $count +} +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-1043A.test b/mysql-test/suite/galera_sr/t/GCF-1043A.test new file mode 100644 index 00000000000..c76623742d7 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1043A.test @@ -0,0 +1,13 @@ +# +# Assertion `retval == WSREP_OK || retval == WSREP_TRX_FAIL || retval == WSREP_BF_ABORT || retval == WSREP_CONN_FAIL' failed with SR +# + +--source include/galera_cluster.inc + +--let $count = 1000; +--let $wsrep_trx_fragment_size = 1; +--let $query_node_1 = DELETE FROM t1 +--let $query_node_1a = REPLACE INTO t1 VALUES (1,'y'),(2,'x') +--let $query_node_2 = REPLACE INTO t1 VALUES (1,'y'),(2,'y'),(3,'y') + +--source suite/galera/include/galera_concurrent_test.inc diff --git a/mysql-test/suite/galera_sr/t/GCF-1043B.test b/mysql-test/suite/galera_sr/t/GCF-1043B.test new file mode 100644 index 00000000000..e3b6b7439ca --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1043B.test @@ -0,0 +1,13 @@ +# +# Assertion `retval == WSREP_OK || retval == WSREP_TRX_FAIL || retval == WSREP_BF_ABORT || retval == WSREP_CONN_FAIL' failed with SR +# + +--source include/galera_cluster.inc + +--let $count = 1000; +--let $wsrep_trx_fragment_size = 1; +--let $query_node_1 = DELETE FROM t1 +--let $query_node_1a = INSERT INTO t1 VALUES (1,'y'),(2,'x') +--let $query_node_2 = UPDATE t1 SET f2 = 'y' WHERE f1 = 1 OR f1 = 2; + +--source suite/galera/include/galera_concurrent_test.inc diff --git a/mysql-test/suite/galera_sr/t/GCF-1051.test b/mysql-test/suite/galera_sr/t/GCF-1051.test new file mode 100644 index 00000000000..1db4ed15c41 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1051.test @@ -0,0 +1,51 @@ +# +# Test the case where SR is rolled back to savepoint that points to the +# very beginning of the transaction. This results in regular rollback +# rather than rollback to savepoint. +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size=1; + +# +# Test 1: regular transaction +# +--connection node_1 +START TRANSACTION; +SAVEPOINT A; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT A; +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# +# Test 2: AUTOCOMMIT OFF +# +--connection node_1 +SET AUTOCOMMIT=OFF; +SAVEPOINT A; +INSERT INTO t1 VALUES (2); +ROLLBACK TO SAVEPOINT A; +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-1060.test b/mysql-test/suite/galera_sr/t/GCF-1060.test new file mode 100644 index 00000000000..714a5ef9f90 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-1060.test @@ -0,0 +1,9 @@ +--source include/galera_cluster.inc + +--let $count = 100; +--let $wsrep_trx_fragment_size = 1; +--let $query_node_1 = TRUNCATE TABLE t1 +--let $query_node_1a = INSERT INTO t1 VALUE (1,'x'),(2,'x'),(3,'x') +--let $query_node_2 = INSERT INTO t1 VALUE (4, 'z'); + +--source suite/galera/include/galera_concurrent_test.inc diff --git a/mysql-test/suite/galera_sr/t/GCF-561.test b/mysql-test/suite/galera_sr/t/GCF-561.test new file mode 100644 index 00000000000..eadf0263ada --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-561.test @@ -0,0 +1,72 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of DDL on a concurrent SR transaction +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 5 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log; + +ALTER TABLE t1 DROP COLUMN f2; + +# SR applied before the DDL is no longer visible +SELECT COUNT(*) AS EXPECT_0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +# Transaction can not continue due to DDL, implicit ROLLBACK +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (6, 6); + +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; + +# DDL is now in effect +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t1 VALUES (6, 6); + +# But it should be possible to reissue the transaction + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; + +--connection node_2 +set global wsrep_sync_wait=15; +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) AS EXPECT_5 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-571.test b/mysql-test/suite/galera_sr/t/GCF-571.test new file mode 100644 index 00000000000..aca0b9f7907 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-571.test @@ -0,0 +1,54 @@ +# +# GCF-571 ROLLBACK TO SAVEPOINT causes all SR records to be deleted +# + +--source include/galera_cluster.inc + +SET AUTOCOMMIT=OFF; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +INSERT INTO t1 VALUES ('%abcdef%'); +SAVEPOINT A; +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); +INSERT INTO t1 VALUES ('xyzxyz'); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; + +--connection node_1 +ROLLBACK TO SAVEPOINT A; + +--connection node_1a +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%'; + +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%abcdef%'; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%xyz%'; +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%SAVEPOINT `A`%'; +SELECT COUNT(*) = 1 FROM mysql.wsrep_streaming_log WHERE frag LIKE '%ROLLBACK TO `A`%'; + +--connection node_1 +ROLLBACK; + +--connection node_1a +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-572.test b/mysql-test/suite/galera_sr/t/GCF-572.test new file mode 100644 index 00000000000..abefb9b08f6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-572.test @@ -0,0 +1,54 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +# +# Test 1: statement rollback is not safe +# (some fragments were already replicated) +# + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'node1'); + +--connection node_1a +INSERT INTO t1 VALUES (5, 'node2'); + +--connection node_1 +# If we try to INSERT a duplicate key, ER_LOCK_DEADLOCK is the only possible +# outcome at this point. Notice that ER_DUP_ENTRY is NOT an option here +# because we were forced to rollback the whole transaction (not just the +# statement) +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (5, 'node1'); + +SELECT * FROM t1; + +# +# Test 2: statement rollback is safe +# (no fragments have been replicated) +# + +SET SESSION wsrep_trx_fragment_size = 10000; + +START TRANSACTION; +INSERT INTO t1 VALUE (10, 'node1'); +SELECT * FROM mysql.wsrep_streaming_log; + +--connection node_1a +INSERT INTO t1 VALUES(15, 'node2'); + +--connection node_1 +SELECT * FROM t1; +# This time, only the statement is rolled back and we expect ER_DUP_ENTRY. +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES(15, 'node1'); + +COMMIT; +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-580.test b/mysql-test/suite/galera_sr/t/GCF-580.test new file mode 100644 index 00000000000..39a237fda57 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-580.test @@ -0,0 +1,27 @@ +# +# GCF-580 wsrep_last_committed_counter increases twice for every SR fragment +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); + +--let $fragments_count = `SELECT COUNT(*) FROM mysql.wsrep_streaming_log` +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--disable_query_log +--eval SELECT ($wsrep_last_committed_after - $wsrep_last_committed_before) = $fragments_count AS last_committed_matches_fragment_count +--enable_query_log + +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-585.test b/mysql-test/suite/galera_sr/t/GCF-585.test new file mode 100644 index 00000000000..ceb7da60df6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-585.test @@ -0,0 +1,44 @@ +# +# GCF-585 SR: Assertion `total_length + wsrep_get_fragment_base(thd) == saved_pos' failed in wsrep_write_cache_once after SQL error +# + +--source include/galera_cluster.inc + +# Test case #1 + +create table t1 (f1 integer primary key) engine=innodb; +set autocommit=off; +set session wsrep_trx_fragment_size=1; +start transaction; +insert into t1 values (1); +# If we try to INSERT a duplicate key, ER_LOCK_DEADLOCK is the only possible +# outcome at this point. Notice that ER_DUP_ENTRY is NOT an option here +# because we were forced to rollback the whole transaction (not just the +# statement) +--error ER_LOCK_DEADLOCK +insert into t1 values (2),(1); +alter table t1 drop primary key; +drop table t1; + +# Test case #2 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +update t1 set f1 = 100 where f1 = 10; + +--connection node_2 +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +SET SESSION wsrep_trx_fragment_size=1; +SET SESSION innodb_lock_wait_timeout=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +--error ER_LOCK_DEADLOCK +delete from t1 where f1 > 10; +--error ER_LOCK_DEADLOCK +delete from t1 where f1 > 10 and f1 < 100; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-597.test b/mysql-test/suite/galera_sr/t/GCF-597.test new file mode 100644 index 00000000000..d3d80ffc4f8 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-597.test @@ -0,0 +1,29 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +SET wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); + +--connection node_1 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--error ER_LOCK_DEADLOCK +ROLLBACK; + +DROP TABLE t1;
\ No newline at end of file diff --git a/mysql-test/suite/galera_sr/t/GCF-620.test b/mysql-test/suite/galera_sr/t/GCF-620.test new file mode 100644 index 00000000000..abfba47ee5a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-620.test @@ -0,0 +1,22 @@ +# +# GCF-620 SR: ROLLBACK TO SAVEPOINT causes slave crash if wsrep_trx_fragment_size does not fall on boundary +# + +--source include/galera_cluster.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 200; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (1); +SAVEPOINT A; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT A; +COMMIT; + +--connection node_2 +SELECT COUNT(*) = 2 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-623.test b/mysql-test/suite/galera_sr/t/GCF-623.test new file mode 100644 index 00000000000..6784989bde9 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-623.test @@ -0,0 +1,31 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1;
\ No newline at end of file diff --git a/mysql-test/suite/galera_sr/t/GCF-627.test b/mysql-test/suite/galera_sr/t/GCF-627.test new file mode 100644 index 00000000000..86637ad8e7f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-627.test @@ -0,0 +1,30 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER); + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); + +--connection node_2 +DROP TABLE t1; + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--error ER_NO_SUCH_TABLE +INSERT INTO t1 VALUES (2); + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/t/GCF-845.test b/mysql-test/suite/galera_sr/t/GCF-845.test new file mode 100644 index 00000000000..316317c6a10 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-845.test @@ -0,0 +1,30 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE IF NOT EXISTS t1 (f1 INTEGER) ENGINE = InnoDB; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (161); +COMMIT; +DELETE FROM t1 WHERE f1 > 13; +--disconnect node_1a +--sleep 2 + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_count = 0 +--let $assert_select = BF-BF X +--let $assert_text = No BF-BF log line found +--let $assert_only_after = CURRENT_TEST +--source include/assert_grep.inc + diff --git a/mysql-test/suite/galera_sr/t/GCF-851.test b/mysql-test/suite/galera_sr/t/GCF-851.test new file mode 100644 index 00000000000..28d5302a422 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-851.test @@ -0,0 +1,24 @@ +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION WSREP_TRX_FRAGMENT_SIZE=1; +SET SESSION AUTOCOMMIT=OFF; + +INSERT INTO t1 VALUES (10); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +START TRANSACTION; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) > 0 FROM t1; + +--connection node_1 +SELECT COUNT(*) > 0 FROM t1; +DROP TABLE t1; + diff --git a/mysql-test/suite/galera_sr/t/GCF-867.test b/mysql-test/suite/galera_sr/t/GCF-867.test new file mode 100644 index 00000000000..54476a860b7 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-867.test @@ -0,0 +1,42 @@ +# +# Test many ongoing SR transactions +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; +--disable_query_log + +--let $connections = 62 + +--let $count = $connections +while ($count) +{ +--connect $count, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET SESSION wsrep_sync_wait = 0; +--dec $count +} + + +--let $count = $connections +while ($count) +{ +--connection $count +START TRANSACTION; +--send_eval INSERT INTO t1 VALUES ($count) +--dec $count +} + +--let $count = $connections +while ($count) +{ +--connection $count +--reap +COMMIT; +--dec $count +} + +--enable_query_log +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/GCF-889.test b/mysql-test/suite/galera_sr/t/GCF-889.test new file mode 100644 index 00000000000..e785b282019 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-889.test @@ -0,0 +1,29 @@ +--source include/galera_cluster.inc + +--connection node_2 +SET GLOBAL wsrep_ignore_apply_errors = 2; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +SET SESSION wsrep_on = OFF; +INSERT INTO t1 VALUES (1); +SET SESSION wsrep_on = ON; + +SET SESSION wsrep_trx_fragment_size = 1; +DELETE FROM t1 WHERE f1 = 1; +SET SESSION wsrep_trx_fragment_size = 0; + +INSERT INTO t1 VALUES (1); + +SELECT COUNT(*) = 1; + +--connection node_2 +SELECT COUNT(*) = 1; +CALL mtr.add_suppression("Could not execute Delete_rows event on table"); +CALL mtr.add_suppression("Can't find record in 't1'"); +SET GLOBAL wsrep_ignore_apply_errors = 7; + +--connection node_1 +DROP TABLE t1; + diff --git a/mysql-test/suite/galera_sr/t/GCF-900.test b/mysql-test/suite/galera_sr/t/GCF-900.test new file mode 100644 index 00000000000..3f1b53630b6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/GCF-900.test @@ -0,0 +1,28 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 128; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 0); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (2, 0); + +--connection node_2 +ALTER TABLE t1 DROP COLUMN f2; + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +--connection node_1a +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (3, 0); + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-18585.cnf b/mysql-test/suite/galera_sr/t/MDEV-18585.cnf new file mode 100644 index 00000000000..00801511d76 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-18585.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates diff --git a/mysql-test/suite/galera_sr/t/MDEV-18585.test b/mysql-test/suite/galera_sr/t/MDEV-18585.test new file mode 100644 index 00000000000..18bbbe8f7e0 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-18585.test @@ -0,0 +1,42 @@ +# +# MDEV-18686 Verify that the Annotate_rows_log_event is written only +# once per statement into binlog. +# +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY); + +# +# Unit ROW +# +SET SESSION wsrep_trx_fragment_unit='ROWS'; +SET SESSION wsrep_trx_fragment_size=1; + +INSERT INTO t1 VALUES (1), (2); + +# +# Unit BYTE +# +SET SESSION wsrep_trx_fragment_unit='BYTES'; +SET SESSION wsrep_trx_fragment_size=1; + +INSERT INTO t1 VALUES (3), (4); + +# +# Unit STATEMENT +# +SET SESSION wsrep_trx_fragment_unit='STATEMENTS'; +SET SESSION wsrep_trx_fragment_size=1; + +INSERT INTO t1 VALUES (5), (6); + +# +# Reset to default settings +# +SET SESSION wsrep_trx_fragment_unit=default; +SET SESSION wsrep_trx_fragment_size=default; + +--replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ +SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-22616.test b/mysql-test/suite/galera_sr/t/MDEV-22616.test new file mode 100644 index 00000000000..818d787703f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-22616.test @@ -0,0 +1,18 @@ +# +# MDEV-22616 +# +# CHECK TABLE fails with wsrep_trx_fragment_size > 0 +# + +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +CHECK TABLE t1; + +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +CHECK TABLE t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera-features#56.test b/mysql-test/suite/galera_sr/t/galera-features#56.test new file mode 100644 index 00000000000..4d46a3bf853 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera-features#56.test @@ -0,0 +1,65 @@ +## +## This test tests parallel application of multiple auto-increment insert transactions +## + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +# Create a second connection to node1 so that we can run transactions concurrently +--let $galera_connection_name = node_1a +--let $galera_server_number = 1 +--source include/galera_connect.inc +SET SESSION wsrep_trx_fragment_size = 1; + +--connection node_1 +CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) Engine=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + + +--connection node_2 +set session wsrep_sync_wait=15; +SELECT COUNT(*) from ten; +SELECT COUNT(*) from t1; +set session wsrep_sync_wait=0; + +--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` +SET GLOBAL wsrep_slave_threads = 4; + +--let $wait_condition = SELECT COUNT(*) >= 3 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; +--source include/wait_condition.inc + +SET SESSION wsrep_trx_fragment_size = 1; + +--connection node_1 +--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_1a +--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +--send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_1 +--reap + +--connection node_1a +--reap + +--connection node_2 +--reap + +set session wsrep_sync_wait=15; +SELECT COUNT(*) FROM t1; +SELECT COUNT(DISTINCT f1) FROM t1; + +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + +--connection default +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc new file mode 100644 index 00000000000..cd9884cee81 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.inc @@ -0,0 +1,145 @@ +# +# Test SR BF abort for all sync points in master side code path +# +# The procedure in all test cases is the following: +# 1) Start SR transaction on node 1, do INSERT + SELECT .. FOR UPDATE +# 2) Set up sync point on node 1 to block slave thread processing +# in apply monitor +# 3) Do write on node 2 which will conflict with SELECT .. FOR UPDATE +# 4) Set up desired sync point on master side and commit +# 5) Wait until commit reaches master side sync point, clear sync points +# and release all sync point waiters +# 6) COMMIT on node 1 should return deadlock error +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--eval SET SESSION wsrep_trx_fragment_size = $wsrep_trx_fragment_size +SET AUTOCOMMIT=OFF; + +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 FOR UPDATE; + +# Set up sync point +--connection node_1a +--let galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# Conflicting insert +--connection node_2 + +SET AUTOCOMMIT=ON; +INSERT INTO t1 VALUES (2); + +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = $galera_sr_bf_abort_sync_point +--source include/galera_set_sync_point.inc + +--connection node_1 +if ($galera_sr_bf_abort_at_commit) +{ + --send COMMIT +} +if (!$galera_sr_bf_abort_at_commit) +{ + --send INSERT INTO t1 VALUES (3) +} + +--connection node_1a + +--let $cmp = `SELECT STRCMP('apply_monitor_slave_enter_sync', '$galera_sr_bf_abort_sync_point') = -1` + +if ($cmp) +{ + --let $galera_sync_point = apply_monitor_slave_enter_sync $galera_sr_bf_abort_sync_point +} +if (!$cmp) +{ + --let $galera_sync_point = $galera_sr_bf_abort_sync_point apply_monitor_slave_enter_sync +} +--source include/galera_wait_sync_point.inc + +# Let conflicting insert proceed, make sure it hits abort_trx_end and +# let both threads continue. + +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = abort_trx_end $galera_sr_bf_abort_sync_point + +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = $galera_sr_bf_abort_sync_point +--source include/galera_signal_sync_point.inc + +# Deadlock should now be retured by node_1 +--connection node_1 +if (!$galera_sr_bf_abort_at_commit) +{ + --error ER_LOCK_DEADLOCK + --reap +} +if ($galera_sr_bf_abort_at_commit) +{ + --reap +} + +ROLLBACK; + +# Release slave insert +--connection node_1a +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc + +# Verify that nodes are consistent + +# End result: +# If the statement which was BF aborted was commit, +# node_1 must replay the transaction so that the table +# will have rows 1, 2. If it in turn was INSERT, +# node_1 must abort the transaction so that only +# INSERT ... VALUES (2) survives. + +--connection node_1 +SELECT * FROM t1; +if ($galera_sr_bf_abort_at_commit) +{ + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +} +if (!$galera_sr_bf_abort_at_commit) +{ + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +} +--connection node_2 +SELECT * FROM t1; +if ($galera_sr_bf_abort_at_commit) +{ + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +} +if (!$galera_sr_bf_abort_at_commit) +{ + SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +} + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# Delete entery to verify that node is unblocked +--connection node_1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 0; +DELETE FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test new file mode 100644 index 00000000000..a2db6a8bad2 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_bf_abort.test @@ -0,0 +1,50 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--let $wsrep_trx_fragment_size = 1 + +# Control connection for manipulating sync points on node 1 +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait = 0; + +--echo galera_sr_bf_abort_at_commit = 0 +--let $galera_sr_bf_abort_at_commit = 0 + +--echo after_replicate_sync +--let $galera_sr_bf_abort_sync_point = after_replicate_sync +--source galera_sr_bf_abort.inc + +--echo local_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +--echo apply_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +--echo commit_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +--echo galera_sr_bf_abort_at_commit = 1 +--let $galera_sr_bf_abort_at_commit = 1 + +--echo after_replicate_sync +--let $galera_sr_bf_abort_sync_point = after_replicate_sync +--source galera_sr_bf_abort.inc + +--echo local_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = local_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +--echo apply_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = apply_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +--echo commit_monitor_master_enter_sync +--let $galera_sr_bf_abort_sync_point = commit_monitor_master_enter_sync +--source galera_sr_bf_abort.inc + +CALL mtr.add_suppression("WSREP: fragment replication failed: 1"); diff --git a/mysql-test/suite/galera_sr/t/galera_sr_blob.test b/mysql-test/suite/galera_sr/t/galera_sr_blob.test new file mode 100644 index 00000000000..ed314d09f5a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_blob.test @@ -0,0 +1,38 @@ +# +# Test that a single-blob will be replicated using SR if it is sufficiently +# large. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 TEXT) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_1 +INSERT INTO t1 VALUES (REPEAT('x', 65535)); + +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +# Confirm that exactly one fragment was replicated + +--disable_query_log +--eval SELECT ($wsrep_last_committed_after - $wsrep_last_committed_before) = 1 AS wsrep_last_committed_delta; +--enable_query_log + +--connection node_1 +COMMIT; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT LENGTH(f1) = 65535 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test new file mode 100644 index 00000000000..da547c59626 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test @@ -0,0 +1,100 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of Cluster Configuration Change on a concurrently-running SR transaction +# We use SET GLOBAL wsrep_cluster_address = '' to cause the master (node_2) to temporarily +# leave the cluster. +# + +CALL mtr.add_suppression("WSREP: discarding established.*"); + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +# +# Trigger CC . The transaction is aborted and we expect the SR tables to be cleaned up +# + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET SESSION wsrep_sync_wait=0; +--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` +SET GLOBAL wsrep_cluster_address = ''; + +--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SET SESSION wsrep_sync_wait = DEFAULT; + +--connection node_2 +--error 2013 # CR_SERVER_LOST +INSERT INTO t1 VALUES (6); + +--connection node_1 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +# Restore cluster + +--connection node_2a +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig' +--enable_query_log + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + + +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2b +--source include/galera_wait_ready.inc +SELECT * FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +# Repeat transaction to confirm no locks are left from previous transaction + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +COMMIT; + +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +--connection node_2b +CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for"); + +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_no_primary.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_no_primary.test new file mode 100644 index 00000000000..13a1b0f009e --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_no_primary.test @@ -0,0 +1,85 @@ +# +# This test verifies that an orphaned SR gets cleanup upon cluster +# reconnection. Specifically, the case where the cluster goes through +# a state of no primary components, and the nodes rejoin with the +# same IDs. +# + +--source include/galera_cluster.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); + +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); + +--connection node_2 +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +SELECT COUNT(*) `expect 6` FROM mysql.wsrep_streaming_log; + +# isolate node 2 +--connection node_2a +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_status'; +SET SESSION wsrep_sync_wait = DEFAULT; + +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_status'; +SET SESSION wsrep_sync_wait = DEFAULT; + +--connection node_2a +# reconnect node 2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +--source include/galera_wait_ready.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; + +--connection node_1a +# wait for reconnection and check that the streaming log has been cleared +--source include/galera_wait_ready.inc +SHOW STATUS LIKE 'wsrep_cluster_size'; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; + +--connection node_2a +# check that the streaming log has been cleared and there are no locks +# from the SRs by issuing conflicting inserts +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +INSERT INTO t1 VALUES(10); +INSERT INTO t1 VALUES(20); +SELECT * FROM t1; + +# check that both SRs have been rolled back +--connection node_1 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES(13); + +--connection node_2 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES(23); + +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test new file mode 100644 index 00000000000..7ba0f253b4a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test @@ -0,0 +1,105 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of Cluster Configuration Change on a concurrently-running SR transaction +# We use SET GLOBAL wsrep_cluster_address = '' to cause the slave (node_2) to temporarily +# leave the cluster. +# + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../../galera/include/auto_increment_offset_save.inc + +# Start with a clean slate +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +# +# Trigger CC . The transaction should be able to continue +# + +--connection node_2 +--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` +SET GLOBAL wsrep_cluster_address = ''; + +# Wait until the node_2 disconnects from the cluster +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc +SET SESSION wsrep_sync_wait = default; + +--connection node_1 + +# Wait until the node_1 sees the cluster configuration change +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Continue generating events in the transaction + +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (10); + +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +# Restore cluster + +--connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_cluster_address='$wsrep_cluster_address_orig'; +--enable_query_log +--source include/galera_wait_ready.inc + +# Confirm that the SR table still contains entries from ongoing transaction +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +# Continue and finalize transaction +--connection node_1 +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (16); +COMMIT; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# Confirm that transaction was replicated properly +# and SR table is cleaned up afterwards. + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 15 FROM t1; +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +CALL mtr.add_suppression("points to own listening address, blacklisting"); + +# Restore original auto_increment_offset values. +--source ../../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test b/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test new file mode 100644 index 00000000000..9ec7143d25c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_concurrent.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test two concurrent SR-replicated transactions +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t2 VALUES (1); +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); + +--connection node_1 +COMMIT; + +--connection node_1a +COMMIT; + +--connection node_2 +SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) = 5 FROM t2; + +--connection node_1 + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict.test new file mode 100644 index 00000000000..dd133c2d12e --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# A conflict between a streaming replication fragment and a local transaction +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +# Wait until a streaming replication fragment has arrived +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +# Attempt a conflicting INSERT. This will block +--send INSERT INTO t1 VALUES(1); + +# Observe the block from a separate connection +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'wsrep applier committed%'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'update'; +--source include/wait_condition.inc + +# Commit the remote transaction, causing the local transaction to return an error +--connection node_1 +COMMIT; + +--connection node_2 +--error ER_DUP_ENTRY +--reap + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test new file mode 100644 index 00000000000..6675321641f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit.test @@ -0,0 +1,45 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the following sequence of events: +# +# 1. Node #2 begins a transaction +# 2. Node #1 begins conflicting transaction that is SR replicated +# 3. Node #2 attempts to commit, gets a deadlock error, even before #1 has committed +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); + +--connection node_1 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; + +--connection node_1 +COMMIT; + +SELECT COUNT(*) = 5 FROM t1; + +--connection node_2 +SELECT COUNT(*) = 5 FROM t1; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test new file mode 100644 index 00000000000..0ea52290bb6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_on_commit2.test @@ -0,0 +1,46 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the following sequence of events: +# +# 1. Node #1 begins a transaction that is SR replicated +# 2. Node #2 begins a conflicting transaction, hangs +# 3. Node #1 comits +# 4. Node #2 gets a dup key error +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_1 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--send INSERT INTO t1 VALUES (5); + +--sleep 1 + +--connection node_1 +COMMIT; + +--connection node_2 +--error ER_DUP_ENTRY +--reap + +SELECT COUNT(*) = 5 FROM t1; + +--connection node_2 +SELECT COUNT(*) = 5 FROM t1; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test b/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test new file mode 100644 index 00000000000..cb96fae0122 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_conflict_with_rollback_master.test @@ -0,0 +1,44 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the following sequence of events: +# +# 1. Node #2 begins a transaction +# 2. Node #1 begins conflicting transaction that is SR replicated +# 3. Node #1 rolls back +# 4. Node #2 can not commit because it was BF-aborted even though the SR transaction was rolled back +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); + +--connection node_1 +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +ROLLBACK; + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; + +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +SELECT COUNT(*) = 0 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_create_drop.test b/mysql-test/suite/galera_sr/t/galera_sr_create_drop.test new file mode 100644 index 00000000000..b7987d26191 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_create_drop.test @@ -0,0 +1,33 @@ +# +# Verify that CREATE/DROP DDLs work when streaming replication is on. +# + +--source include/galera_cluster.inc + +SET SESSION wsrep_trx_fragment_size=1; + +# +# CREATE/DROP TABLE succeeds and the change is propagated to node_2. +# +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +--connection node_2 +SHOW CREATE TABLE t1; +--connection node_1 +DROP TABLE t1; +--connection node_2 +--error ER_NO_SUCH_TABLE +SHOW CREATE TABLE t1; + +# +# CREATE/DROP DATABASE succeeds and the change is propagated to node_2. +# +CREATE DATABASE mdev_18587; +--connection node_2 +SHOW DATABASES LIKE 'mdev_18587'; +--connection node_1 +DROP DATABASE mdev_18587; +--connection node_2 +SHOW DATABASES LIKE 'mdev_18587'; +--connection node_1 + +SET SESSION wsrep_trx_fragment_size=DEFAULT; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test new file mode 100644 index 00000000000..3c42cb2a0a2 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test @@ -0,0 +1,66 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the following sequence of events on the master: +# +# 1. Connection #1 begins a SR transaction +# 2. Connection #2 issues DDL +# 3. Connection #1 attempts to continue the transaction, gets deadlock +# 4. Connection #1 retries the transaction and succeeds +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +# SR replication is triggered and rows have been delivered to the slave +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; + +SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_1 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (6); + +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; + +# Check that the transaction thus aborted could be reissued + +ROLLBACK; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES (1); +INSERT INTO t1 (f1) VALUES (2); +INSERT INTO t1 (f1) VALUES (3); +INSERT INTO t1 (f1) VALUES (4); +INSERT INTO t1 (f1) VALUES (5); +INSERT INTO t1 (f1) VALUES (6); +COMMIT; + +SELECT COUNT(*) as expect_6 FROM t1; +SELECT * FROM t1; +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) as expect_6 FROM t1; +SELECT * FROM t1; +SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test new file mode 100644 index 00000000000..a3045773387 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_schema.test @@ -0,0 +1,43 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of DROP SCHEMA DDL on a concurrent SR transaction +# Most other DDL tests work on a table level, so this test exercises a +# different granularity. +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +DROP SCHEMA test; + +--error ER_NO_SUCH_TABLE +SELECT COUNT(*) = 0 FROM test.t1; + +--connection node_1 + +# Transaction can not continue due to DDL +--error ER_LOCK_DEADLOCK +INSERT INTO test.t1 VALUES (6, 6); + +# DDL is now in effect +--error ER_NO_SUCH_TABLE +INSERT INTO test.t1 VALUES (6, 6); + +CREATE SCHEMA test; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test new file mode 100644 index 00000000000..4a652284e59 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_slave.test @@ -0,0 +1,65 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of DDL on a concurrent SR transaction +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +ALTER TABLE t1 DROP COLUMN f2; + +# SR applied before the DDL is no longer visible +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +# Transaction can not continue due to DDL, implicit ROLLBACK +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (6, 6); + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# DDL is now in effect +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t1 VALUES (6, 6); + +# But it should be possible to reissue the transaction + +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; + +--connection node_2 +SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test new file mode 100644 index 00000000000..77b6e64641d --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_unrelated.test @@ -0,0 +1,53 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of unrelated DDL on a concurrent SR transaction +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1, 1); +INSERT INTO t1 VALUES (2, 2); +INSERT INTO t1 VALUES (3, 3); +INSERT INTO t1 VALUES (4, 4); +INSERT INTO t1 VALUES (5, 5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +ALTER TABLE t2 DROP COLUMN f2; + +# SR applied before the DDL is still visible +SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 + +# Transaction can continue, even after the DDL +--error 0 +INSERT INTO t1 VALUES (6, 6); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 6 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test b/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test new file mode 100644 index 00000000000..a7aca042829 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_dupkey_error.test @@ -0,0 +1,59 @@ +# +# Test the case where a duplicate key error happens in the middle of an SR transaction +# + +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB; +CREATE UNIQUE INDEX i1 ON t1 (f1(512)); + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1024; + +INSERT INTO t1 VALUES (REPEAT('a', 512)); +INSERT INTO t1 VALUES (REPEAT('b', 512)); +INSERT INTO t1 VALUES (REPEAT('c', 512)); +INSERT INTO t1 VALUES (REPEAT('d', 512)); +INSERT INTO t1 VALUES (REPEAT('e', 512)); +INSERT INTO t1 VALUES (REPEAT('f', 512)); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +# Deadlock error instead of dupkey since the transaction is SR and +# statement rollback is not safe. +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (REPEAT('c', 512)); + +# Confirm that the wsrep_streaming_log table is now empty, as it was a full transaction rollback + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# Confirm that the transaction can be restarted on either node + +--connection node_1 +INSERT INTO t1 VALUES (REPEAT('d', 512)); +INSERT INTO t1 VALUES (REPEAT('e', 512)); +INSERT INTO t1 VALUES (REPEAT('f', 512)); +COMMIT; + +--connection node_2 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (REPEAT('a', 512)); +INSERT INTO t1 VALUES (REPEAT('b', 512)); +INSERT INTO t1 VALUES (REPEAT('c', 512)); +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 6 FROM t1; + +--connection node_2 +SELECT COUNT(*) = 6 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test b/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test new file mode 100644 index 00000000000..b83deaee244 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_fk_conflict.test @@ -0,0 +1,62 @@ +# +# Test Foreign Key with SR +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE grandparent ( + id INT NOT NULL PRIMARY KEY +) ENGINE=InnoDB; + +CREATE TABLE parent ( + id INT NOT NULL PRIMARY KEY, + grandparent_id INT, + FOREIGN KEY (grandparent_id) + REFERENCES grandparent(id) + ON UPDATE CASCADE +) ENGINE=InnoDB; + +CREATE TABLE child ( + id INT NOT NULL PRIMARY KEY, + grandparent_id INT, + FOREIGN KEY (grandparent_id) + REFERENCES parent(grandparent_id) + ON UPDATE CASCADE +) ENGINE=InnoDB; + +INSERT INTO grandparent VALUES (1),(2),(3),(4); +INSERT INTO parent VALUES (1,1), (2,2); +INSERT INTO child VALUES (1,1), (2,2); + +# Start and SR transaction + +--connection node_1 +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; + +UPDATE grandparent SET id = 5 WHERE id = 1; + +# No conflicting transactions are allowed to proceed on slave + +--connection node_2 +SET SESSION innodb_lock_wait_timeout = 1; + +--error ER_LOCK_WAIT_TIMEOUT +UPDATE grandparent SET id = 10 WHERE id = 5; + +--error ER_LOCK_WAIT_TIMEOUT +DELETE FROM child; + +# SR transaction succesffull + +--connection node_1 +COMMIT; + +--let $diff_servers = 1 2 +--source include/diff_servers.inc + +DROP TABLE child; +DROP TABLE parent; +DROP TABLE grandparent; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt new file mode 100644 index 00000000000..6623c33c484 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt @@ -0,0 +1 @@ + --log-bin --log-slave-updates --loose-galera-sr-gtid-unique diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid.test b/mysql-test/suite/galera_sr/t/galera_sr_gtid.test new file mode 100644 index 00000000000..56464ba6f63 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid.test @@ -0,0 +1,46 @@ +# +# Test basic Galera operation +# + +--source include/have_log_bin.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY); + +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; + +SET SESSION wsrep_trx_fragment_size=1; +UPDATE t1 SET f1 = 2; + +#--let $gtid_executed_node2 = `SELECT @@global.gtid_executed;` + +--connection node_1 +SET SESSION wsrep_trx_fragment_size=0; + +--connection node_2 +SET SESSION wsrep_trx_fragment_size=0; + +--connection node_1 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; + +--disable_query_log +#--eval SELECT '$gtid_executed_node2' = @@global.gtid_executed AS gtid_executed_equal; +--enable_query_log + +--replace_regex /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<GTID>/ /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 256; + +--connection node_2 +# Perform causal wait +SELECT 1 FROM DUAL; +--replace_regex /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<GTID>/ /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000003' FROM 256; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test b/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test new file mode 100644 index 00000000000..01481db5a8b --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_insert_select.test @@ -0,0 +1,33 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test large INSERT ... SELECT with SR +# + +--connection node_1 +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +# Insert 10K rows. +INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 99 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1; + +--connection node_1 + +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test new file mode 100644 index 00000000000..8fba27f9a73 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_nobootstrap.test @@ -0,0 +1,52 @@ +# +# Kill entire cluster during SR while pc.bootstrap is in effect +# after restart, confirm that the mysql.wsrep_streaming_log table is empty +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--source include/kill_galera.inc +--connection node_1 +--source include/kill_galera.inc + +--sleep 1 + +# Bootstrap the cluster from scratch + +--connection node_1 +--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/start_mysqld.inc + +--connection node_2 +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + +--connection node_1 +--source include/wait_until_connected_again.inc +--source include/galera_wait_ready.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf new file mode 100644 index 00000000000..82c001e0131 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf @@ -0,0 +1,8 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.recovery=false' +auto_increment_offset=1 + +[mysqld.2] +auto_increment_offset=2 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 new file mode 100644 index 00000000000..5332b1a1579 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test @@ -0,0 +1,71 @@ +# +# Kill entire cluster during SR while pc.recovery is NOT in effect +# after restart, confirm that the mysql.wsrep_streaming_log table is empty +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../../galera/include/auto_increment_offset_save.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + + +# +# Kill the entire cluster and restart +# +--connection node_2 +--source include/kill_galera.inc + +--connection node_1 +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 $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/start_mysqld.inc + +--connection node_2 +--let $start_mysqld_params = "" +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + + +# +# Check that wsrep_streaming_log is empty +# +--connection node_1 +--source include/wait_until_connected_again.inc +--source include/galera_wait_ready.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) `expect 0` FROM t1; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; + + +# +# Cleanup +# +--source ../../galera/include/auto_increment_offset_restore.inc +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test new file mode 100644 index 00000000000..0ba7cedbd8f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_pcrecovery.test @@ -0,0 +1,54 @@ +# +# Kill entire cluster during SR while pc.recovery is in effect +# after restart, confirm that the mysql.wsrep_streaming_log table is empty +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--source include/kill_galera.inc +--connection node_1 +--source include/kill_galera.inc + +--sleep 1 + +# Bootstrap the cluster from scratch + +--connection node_1 +--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/start_mysqld.inc + +--connection node_2 +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc + +--connection node_1 +--source include/wait_until_connected_again.inc +--source include/galera_wait_ready.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test new file mode 100644 index 00000000000..03d09f33fab --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_connection.test @@ -0,0 +1,59 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test KILL CONNECTION on a transaction that has already replicated some data via SR +# + +SET SESSION wsrep_trx_fragment_size = 1; + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +# Confirm that the transaction is SR-replicated +--connection node_2 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +# Kill the transaction by killing the entire connection + +--connection node_1 +--let $connection_id = `SELECT CONNECTION_ID()` +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--disable_query_log +--eval KILL CONNECTION $connection_id +--enable_query_log + +# Confirm that the disconnection caused the updates made so far to be removed +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc + +# Confirm that the transaction can be reissued in its entirety on the slave without a conflict + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +COMMIT; + +SELECT COUNT(*) = 5 FROM t1; + +--connection node_1a +SELECT COUNT(*) = 5 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test new file mode 100644 index 00000000000..5282baed86d --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_query.test @@ -0,0 +1,50 @@ +--source include/galera_cluster.inc + +# +# Test KILL QUERY on a statement that has already replicated some data via SR +# + +SET SESSION wsrep_trx_fragment_size = 1; + +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; + +--let $connection_id = `SELECT CONNECTION_ID()` +--send INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; + +# Wait for some SR to arrive on the slave. +--connection node_2 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT TABLE_ROWS > 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--connection node_1 +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--echo Killing query ... +--disable_query_log +--eval KILL QUERY $connection_id +--enable_query_log + +--connection node_1 +--error ER_QUERY_INTERRUPTED +--reap + +# Confirm that the kill caused the updates made so far to be removed +--connection node_2 +SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; + +# Confirm that the transaction can be reissued in its entirety on the slave without a conflict + +INSERT INTO t1 SELECT 1 FROM ten AS t1, ten AS t2, ten AS t3; +SELECT COUNT(*) AS EXPECT_1000 FROM t1; + +--connection node_1a +SET GLOBAL wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_1000 FROM t1; + +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf new file mode 100644 index 00000000000..290d8fe196e --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf @@ -0,0 +1,4 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=2' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test new file mode 100644 index 00000000000..a76a03e49b9 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.test @@ -0,0 +1,80 @@ +# +# This test kills the slave while a Streaming Replication transaction is in +# progress but before a fragment has already been applied on the slave. It +# is expected that after the slave restarts, the cluster will continue to +# be consistent. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# Block node #2's applier before table t1's inserts have come into play + +--connection node_2 +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +CREATE TABLE t2 (f1 INTEGER); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +LOCK TABLE t2 WRITE; + +--connection node_1 +INSERT INTO t2 VALUES (1); + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; + +--connection node_1 +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--sleep 2 + +--connection node_2 +--source include/kill_galera.inc +--sleep 1 + +--connection node_1 +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (10); + +--connection node_2 +--source include/start_mysqld.inc +--sleep 1 + +--source include/wait_until_connected_again.inc +--source include/galera_wait_ready.inc + +--connection node_1 +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); +INSERT INTO t1 VALUES (15); +COMMIT; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--sleep 5 +SELECT COUNT(*) = 15 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt new file mode 100644 index 00000000000..132c6aed246 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment-master.opt @@ -0,0 +1 @@ +--innodb_log_file_size=1G --binlog-row-event-max-size=100M diff --git a/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test new file mode 100644 index 00000000000..63278555723 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_large_fragment.test @@ -0,0 +1,58 @@ +# +# Test the replication and subsequent cleanup of a few, very large fragments +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +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 PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1024 * 1024 * 10; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; + +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 50000 FROM t1; + +--connection node_1 +ROLLBACK; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--let $wsrep_provider_options_node_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'` +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_2'; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--let $wsrep_provider_options_node_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'` +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_1'; + +DROP TABLE ten; +DROP TABLE t1; + +CALL mtr.add_suppression('InnoDB: Resizing redo log from'); +CALL mtr.add_suppression('InnoDB: Starting to delete and rewrite log files'); +CALL mtr.add_suppression('InnoDB: New log files created, LSN='); + diff --git a/mysql-test/suite/galera_sr/t/galera_sr_load_data.test b/mysql-test/suite/galera_sr/t/galera_sr_load_data.test new file mode 100644 index 00000000000..363443a9e64 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_load_data.test @@ -0,0 +1,49 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test Streaming Replication + LOAD DATA +# + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 512; + +# Create a file for LOAD DATA with 20K entries +--perl +open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_sr_load_data.csv") or die; +foreach my $i (1..20000) { + print FILE "$i\n"; +} +EOF + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# Record wsrep_last_committed as it was before LOAD DATA +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_1 +--disable_query_log +--disable_warnings +set global wsrep_load_data_splitting=ON; +--enable_warnings +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_sr_load_data.csv' INTO TABLE t1; +--enable_query_log + +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +SELECT COUNT(*) = 20000 FROM t1; +# LOAD-ing 20K rows causes 3 commits to be registered +--disable_query_log +--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before = 3 AS wsrep_last_committed_diff +--enable_query_log + +--connection node_1 +--disable_query_log +--disable_warnings +set global wsrep_load_data_splitting=OFF; +--enable_warnings +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test b/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test new file mode 100644 index 00000000000..40e63e7c67f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_load_data_splitting.test @@ -0,0 +1,50 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +# +# Test Streaming Replication and LOAD DATA splitting operating at the same time +# + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +--let $wsrep_load_data_splitting_orig = `SELECT @@wsrep_load_data_splitting` + +SET SESSION wsrep_trx_fragment_size = 512; +SET GLOBAL wsrep_load_data_splitting = TRUE; + + +# Create a file for LOAD DATA with 95K entries +--perl +open(FILE, ">", "$ENV{'MYSQLTEST_VARDIR'}/tmp/galera_sr_load_data.csv") or die; +foreach my $i (1..95000) { + print FILE "$i\n"; +} +EOF + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# Record wsrep_last_committed as it was before LOAD DATA +--connection node_2 +--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_1 +--disable_query_log +--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/galera_sr_load_data.csv' INTO TABLE t1; +--enable_query_log + +--connection node_2 +--let $wsrep_last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +SELECT COUNT(*) = 95000 FROM t1; + +# LOAD-ing 95K rows causes 10 'commits' to be registered +--disable_query_log +--eval SELECT $wsrep_last_committed_after - $wsrep_last_committed_before = 10 AS wsrep_last_committed_diff; +--enable_query_log + +--connection node_1 +--disable_query_log +--eval SET GLOBAL wsrep_load_data_splitting = $wsrep_load_data_splitting_orig; +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt new file mode 100644 index 00000000000..03fcb5d040d --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_log_bin-master.opt @@ -0,0 +1 @@ +--log-slave-updates --log-bin diff --git a/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test b/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test new file mode 100644 index 00000000000..7dfa7850c15 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_log_bin.test @@ -0,0 +1,70 @@ +# +# Interleave SR and non-SR transactions and confirm that the binlog is in correct order +# + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t3 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t4 (f1 INTEGER) ENGINE=InnoDB; + +--source include/galera_cluster.inc + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t2 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t3 VALUES (1); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t4 VALUES (1); + +--connection node_1 +INSERT INTO t1 VALUES (2); +COMMIT; + +--connection node_1a +INSERT INTO t2 VALUES (2); +COMMIT; + +--connection node_2 +INSERT INTO t3 VALUES (2); +COMMIT; +--connection node_2a +INSERT INTO t4 VALUES (2); +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 2 FROM t4; + +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; + +--connection node_2 +SELECT COUNT(*) = 2 FROM t4; + +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; + +DROP TABLE t1,t2,t3,t4; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test new file mode 100644 index 00000000000..9b8dae9d8e3 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_many_fragments.test @@ -0,0 +1,53 @@ +# +# Test the replication and subsequent cleanup of a large number of small transaction fragments +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +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 PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(512)) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 (f2) SELECT REPEAT('x', 512) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 10000 FROM t1; + +--connection node_1 +ROLLBACK; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--let $wsrep_provider_options_node_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'` +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_2'; + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--let $wsrep_provider_options_node_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_provider_options'` +SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT10M'; +SET SESSION wsrep_sync_wait = 7; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node_1'; + +DROP TABLE ten; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test new file mode 100644 index 00000000000..9004d332393 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_multirow_rollback.test @@ -0,0 +1,156 @@ +# +# Test multirow insert rollback with streaming replication +# + +--source include/galera_cluster.inc + + +# +# Case 1: multirow insert results full rollback if a fragment +# managed to replicate +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +# With fragment size 1 we expect full rollback +# because a fragment is already replicated. +# Therefore, expect ER_LOCK_DEADLOCK instead of ER_DUP_ENTRY +--error ER_LOCK_DEADLOCK +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +COMMIT; + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 2: error on multirow insert results in empty commit +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +COMMIT; + +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 3: error on multirow insert does not affect previous statements +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'b'); +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('c'), ('d'); +COMMIT; + +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +--connection node_2 +--echo expect (1,'a'), (2, 'b') +SELECT * FROM t1; + +DROP TABLE t1; + + +# +# Case 4: error on autocommit multirow insert +# +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY DEFAULT 0, f2 char(12)); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; + +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + + --connection node_1 +SET SESSION wsrep_trx_fragment_size = 1000; +--error ER_DUP_ENTRY +INSERT INTO t1 (f2) VALUES ('a'), ('b'); +SELECT COUNT(*) AS expect_0 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM t1; + +DROP TABLE t1; + + +# +# Case 5: FK constraint violation on multirow insert results +# full rollback if a fragment has already replicated +# +--connection node_1 +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); + +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +--error ER_LOCK_DEADLOCK +INSERT INTO c VALUES (1,1), (2,2); +COMMIT; + +SELECT * FROM p; +SELECT * FROM c; + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + + +# +# Case 6: FK constraint violation on multirow insert results +# stmt rollback if no fragments have replicated +# +--connection node_1 +CREATE TABLE p(id int primary key, j int) ENGINE=InnoDB; +CREATE TABLE c(id int primary key, fk1 int) ENGINE=InnoDB; +ALTER TABLE c ADD FOREIGN KEY (fk1) references p(id); +INSERT INTO p VALUES(1, 0); + +SET SESSION wsrep_trx_fragment_size=1000; +START TRANSACTION; +INSERT INTO c VALUES (3,1); +--error ER_NO_REFERENCED_ROW_2 +INSERT INTO c VALUES (1,1), (2,2); +COMMIT; + +SELECT * FROM p; +SELECT * FROM c; + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test new file mode 100644 index 00000000000..b037f817610 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test @@ -0,0 +1,29 @@ +# +# Test that the basic MyISAM replication works even with SR enabled +# We basically check that the data arrived on the slave and that there +# were no assertions. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 TEXT) ENGINE=MyISAM; + +--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` + +SET SESSION wsrep_trx_fragment_size = 1; +SET GLOBAL wsrep_replicate_myisam = TRUE; + +INSERT INTO t1 VALUES (REPEAT('x', 65535)); + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT LENGTH(f1) = 65535 FROM t1; + +DROP TABLE t1; + +--connection node_1 +--disable_query_log +--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig; +--enable_query_log diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf new file mode 100644 index 00000000000..574ae28b54a --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +# We do not set mysqldump-related SST options here because doing so on startup +# causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test new file mode 100644 index 00000000000..e660895cde6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test @@ -0,0 +1,87 @@ +# +# Test mysqldump SST on slave if SR transaction is in progress +# + +--source include/big_test.inc +--source include/galera_cluster.inc + +--source suite/galera/include/galera_sst_set_mysqldump.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source suite/galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 1000; +START TRANSACTION; +# Insert 1000 rows +INSERT INTO t1 (f2) SELECT REPEAT('x', 255) FROM ten AS a1, ten AS a2, ten AS a3; + +# Update 1000 rows +UPDATE t1 SET f2 = REPEAT('y', 255); + +# Wait for SR replication to kick in +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +# Restart node #2 + +--connection node_2 +--let $MYSQLD2_DATADIR = `SELECT @@datadir` + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +# Force SST +--remove_file $MYSQLD2_DATADIR/grastate.dat + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_2 +--let $restart_noprint = 1 +--let $restart_parameters = --wsrep_sst_auth=sst:sst --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Check that node #2 is caught up with the SR transaction that is still in progress +--connection node_2 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +# Finalize transaction +--connection node_1 +UPDATE t1 SET f2 = REPEAT('z', 255); +COMMIT; + +# Confirm proper replication of entire transaction to node #2 +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 1000 FROM t1; +SELECT COUNT(*) = 1000 FROM t1 WHERE f2 = REPEAT('z', 255); + +DROP TABLE t1; +DROP TABLE ten; + +--connection node_1 +# galera_sst_restore.inc uses DROP USER internally which is incompatible +# with SR, need to disable SR before that. +SET SESSION wsrep_trx_fragment_size=0; +--source suite/galera/include/galera_sst_restore.inc + +# Restore original auto_increment_offset values. +--source suite/galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test b/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test new file mode 100644 index 00000000000..83a7acbe3e0 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_parallel_apply.test @@ -0,0 +1,59 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test SR with parallel apply +# + +--connection node_2 +--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` +SET GLOBAL wsrep_slave_threads = 5; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (1); +--send INSERT INTO t1 (f2) VALUES (1); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (2); +--send INSERT INTO t1 (f2) VALUES (2); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1 WHERE f2 = 1; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1 WHERE f2 = 2; +--source include/wait_condition.inc + +--connection node_1 +--reap +COMMIT; + +--connection node_1a +--reap +ROLLBACK; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 5 FROM t1; + +--connection node_1 +DROP TABLE t1; + +--connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback.test new file mode 100644 index 00000000000..33a318f8ae3 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback.test @@ -0,0 +1,76 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that ROLLBACK works correctly with streaming replication +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) >= 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +ROLLBACK; + +# +# After ROLLBACK, the table on node #2 should be empty +# + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc + +# +# It should be possible to re-insert the values we just rolled back +# + +--connection node_1 +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); + +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) >= 9 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) >= 10 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test new file mode 100644 index 00000000000..c6c443a0828 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_retry.test @@ -0,0 +1,55 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that a SR transaction that was just ROLLBACKed on one node can be +# run against another node without any conflicts +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +ROLLBACK; + +# +# After ROLLBACK, the table on node #2 should be empty +# + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc + +# +# It should be possible to reissue the same transaction against node #2 +# + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +COMMIT; + +SELECT COUNT(*) = 5 FROM t1; + +--connection node_1 +SELECT COUNT(*) = 5 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test new file mode 100644 index 00000000000..93ff7a948c4 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_savepoint.test @@ -0,0 +1,51 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that ROLLBACK TO SAVEPOINT works correctly with streaming replication +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SAVEPOINT s1; +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 5 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +ROLLBACK TO SAVEPOINT s1; + +INSERT INTO t1 VALUES (21, 'c'); +INSERT INTO t1 VALUES (22, 'c'); +INSERT INTO t1 VALUES (23, 'c'); +INSERT INTO t1 VALUES (24, 'c'); +INSERT INTO t1 VALUES (25, 'c'); + +--connection node_2 +SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'a'; +SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 5 FROM t1 WHERE f2 = 'c'; + +--connection node_1 +COMMIT; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test new file mode 100644 index 00000000000..ba981c8c9a3 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test @@ -0,0 +1,59 @@ +# +# Test the case where a statement is rolled back due to an error while +# Streaming Replication is in effect. We construct an INSERT ... SELECT +# statement that will fail with a duplicate key error towards the end of +# the statement, after a portion has already been replicated via SR. +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'); + +# This poison value is used to cause the INSERT ... SELECT below to fail +INSERT INTO t2 VALUES (3, 'b'); + +SET SESSION wsrep_trx_fragment_size = 1; + +--disable_query_log +--let $last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--enable_query_log + +--error ER_DUP_ENTRY +INSERT INTO t2 SELECT * FROM t1; + +# +# We should see three fragments replicated: Rows 1, 2 and rollback fragment. +# +--disable_query_log +--let $last_committed_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` +--eval SELECT $last_committed_after - $last_committed_before AS last_committed_diff +--enable_query_log + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM t2; +--source include/wait_condition.inc + +# Cluster continues to operate after the implicit ROLLBACK; +--connection node_1 +INSERT INTO t2 VALUES (1, 'c'); + +--connection node_2 +INSERT INTO t2 VALUES (2, 'c'); + +--connection node_1 +SELECT * FROM t2; + +--connection node_2 +SELECT * FROM t2; + +--connection node_1 + +SET SESSION wsrep_trx_fragment_size = DEFAULT; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test new file mode 100644 index 00000000000..3f7407fe536 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_master.test @@ -0,0 +1,53 @@ +# +# Shut down master (node #2) while an SR transaction is in progress +# + +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; + +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; + +INSERT INTO t1 VALUES (1),(2),(3); + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Confirm that SR table on slave is empty +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_2 +--source include/start_mysqld.inc + +# SR table on master should be empty too +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# Confirm that the INSERT can be re-issued +INSERT INTO t1 VALUES (1),(2),(3); + +--connection node_1 +SELECT COUNT(*) = 3 FROM t1; + +DROP TABLE t1; + +--connection node_2 +CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for "); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test new file mode 100644 index 00000000000..d1b0d4b8c88 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -0,0 +1,72 @@ +# +# Shut down slave (node #2) while an SR transaction is in progress +# + +--source include/galera_cluster.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE = InnoDB; + +# We start two transactions on the master so that we can commit one while the slave +# is down and commit the other after the slave has rejoined + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (11),(12),(13); + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (21),(22),(23); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Commit one transaction while the slave is down +--connection node_1a +INSERT INTO t1 VALUES (14),(15),(16); +COMMIT; + +# Restart slave +--connection node_2 +--source include/start_mysqld.inc + +# Confirm SR table on slave has entries +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_6 FROM t1 WHERE f1 IN (11,12,13,14,15,16); + +# Commit the second transaction on master after the slave has rejoined +--connection node_1b +INSERT INTO t1 VALUES (24),(25),(26); +COMMIT; + +# Confirm that SR table on slave is empty +--connection node_2 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_12 FROM t1; + +# SR table on master should be empty too +--connection node_1 +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf new file mode 100644 index 00000000000..c8e17436e71 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes.cnf +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=16K' +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=16K' + diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test new file mode 100644 index 00000000000..403b44286d9 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.test @@ -0,0 +1,21 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# A simple test with a very low value for gcache.size - 16K +# + +--connection node_1 +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +SELECT COUNT(*) = 10000 FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test b/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test new file mode 100644 index 00000000000..f44d67e5c8c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_transaction_replay.test @@ -0,0 +1,260 @@ +# +# This test tests the operation of SR transaction replay. If a +# potentially conflicting remote transaction arrives at +# just the right time during the commit of a local transaction, +# the local transaction will be aborted and replayed. +# +# This test is divided in two sections: +# 1) Test the scenario where the last fragment does not have write set +# payload, just commit flag is replicated +# 2) Test the scenario where the last fragment has write set payload +# and commit flag + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +# Control connection for manipulating galera sync points +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait = 0; + +--connection node_1 + +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); + +######################################################################### +# +# 1) Replay without commit fragment write set payload +# +######################################################################### + +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); + +--connection node_1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; + +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; + +# +# Block the commit from node_2 +# +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# Issue conflicting UPDATE from node_2 and wait until it hits the +# apply monitor (but does not apply yet) +# +--connection node_2 +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Set a new sync point to block in local monitor on node_1 commit +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = local_monitor_master_enter_sync +--source include/galera_set_sync_point.inc + +# +# Send the commit on node_1 +# +--connection node_1 +--send COMMIT + +# +# Wait until commit reaches sync point +# +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Release conflicting slave transaction and wait until it has BF +# aborted pending COMMIT +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc + +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc + +--let $galera_sync_point = abort_trx_end local_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Release both threads, local thread will now replay +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc + +--let $galera_sync_point = local_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# +# Commit must succeed +# +--connection node_1 +--reap + + +# +# Check the outcome and that wsrep schema SR table is empty +# +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# +# wsrep_local_replays has increased by 1 +# +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DELETE FROM t1; + +######################################################################### +# +# 2) Replay with commit fragment write set payload +# +######################################################################### + +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); + +--connection node_1 +SET AUTOCOMMIT=ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; + +# +# Do first update SR on +# +UPDATE t1 SET f2 = 'x' WHERE f1 = 1; + +# +# Disable SR for following statements +# +SET SESSION wsrep_trx_fragment_size = 0; + +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; + +# +# Block the commit from node_2 +# +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# Issue conflicting UPDATE from node_2 and wait until it hits the +# apply monitor (but does not apply yet) +# +--connection node_2 +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + +--connection node_1a +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Set a new sync point to block in local monitor on node_1 commit +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = local_monitor_master_enter_sync +--source include/galera_set_sync_point.inc + +# +# Send the commit on node_1 +# +--connection node_1 +--send COMMIT + +# +# Wait until commit reaches sync point +# +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--let $galera_sync_point = apply_monitor_slave_enter_sync local_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Release conflicting slave transaction and wait until it has BF +# aborted pending COMMIT +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc + +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc + +--let $galera_sync_point = abort_trx_end local_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# +# Release both threads, local thread will now replay +# +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc + +--let $galera_sync_point = local_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# +# Commit must succeed +# +--connection node_1 +--reap + + +# +# Check the outcome and that wsrep schema SR table is empty +# +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# +# wsrep_local_replays has increased by 1 +# +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 2 AS wsrep_local_replays; +--enable_query_log + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; +SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DELETE FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test b/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test new file mode 100644 index 00000000000..0cf05765838 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_unit_statements.test @@ -0,0 +1,54 @@ +# +# Test wsrep_fragment_unit = statements +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 3; +SET SESSION wsrep_trx_fragment_unit = 'statements'; + +--connection node_1 +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +# Expect noting is replicated yet, so far we have 2 statements +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_1 +INSERT INTO t1 VALUES (2); + +# Expect 2 rows in t1 and 1 fragment in SR table +--connection node_2 +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + + --connection node_1 +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +# Expect 5 rows in t1 and 2 fragments in SR table +--connection node_2 +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_1 +COMMIT; + +# Expect 5 rows in t1 and empty SR table +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt new file mode 100644 index 00000000000..0b5f8bf7104 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events-master.opt @@ -0,0 +1 @@ +--log-bin-use-v1-row-events=1 --wsrep-trx-fragment-size=1 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test new file mode 100644 index 00000000000..d3d4d2d0c14 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_v1_row_events.test @@ -0,0 +1,27 @@ +# +# Test that Galera SR continues to run even with --log-bin-use-v1-row-events=1 +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 1 FROM t1; + +--connection node_1 +COMMIT; + +SET AUTOCOMMIT=ON; +UPDATE t1 SET f1 = 2 WHERE f1 = 1; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test b/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test new file mode 100644 index 00000000000..98f6e796ef6 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ws_size.test @@ -0,0 +1,70 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that SR transaction is cumulatively allowed to grow beyond repl.max_ws_size +# if individual fragements are below that size +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` + +SET SESSION wsrep_trx_fragment_size = 512; +SET GLOBAL wsrep_provider_options='repl.max_ws_size=4096'; + +# +# Create a transaction larger than repl.max_ws_size +# + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; + +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1; + +# +# We expect that the transaction can proceed successfully +# + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 10 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +# Commit succeeds +COMMIT; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) = 100 FROM t1; + +# +# Cleanup +# + +DROP TABLE t1; +DROP TABLE ten; + +--connection node_1 +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; +--enable_query_log + +call mtr.add_suppression('WSREP: transaction size limit.*'); +call mtr.add_suppression('WSREP: rbr write fail.*'); +call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); +call mtr.add_suppression('WSREP: transaction size exceeded.*'); diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test b/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test new file mode 100644 index 00000000000..2b9bc4819b8 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_ws_size2.test @@ -0,0 +1,62 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test that if wsrep_trx_fragment_size > repl.max_ws_size, no SR takes place and +# the transaction is properly aborted. +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(254)) ENGINE=InnoDB; +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` + +SET SESSION wsrep_trx_fragment_size = 256; +SET GLOBAL wsrep_provider_options='repl.max_ws_size=128'; + +# +# Create a transaction larger than repl.max_ws_size +# + +SET AUTOCOMMIT=OFF; +START TRANSACTION; +--error ER_ERROR_DURING_COMMIT,ER_ERROR_ON_WRITE,ER_BINLOG_ROW_LOGGING_FAILED +INSERT INTO t1 (f2) SELECT REPEAT('x', 254) FROM ten AS a1, ten AS a2; + +# +# We expect that the transaction can not complete successfully +# + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--sleep 2 +SELECT COUNT(*) = 0 FROM t1; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +SELECT COUNT(*) = 0 FROM t1; + +# +# Cleanup +# +--connection node_1 +--disable_query_log +--eval SET GLOBAL wsrep_trx_fragment_size = $wsrep_trx_fragment_size_orig; +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; +--enable_query_log + +DROP TABLE t1; +DROP TABLE ten; + +call mtr.add_suppression('WSREP: SR rollback replication failure.*'); +call mtr.add_suppression('WSREP: transaction size limit.*'); +call mtr.add_suppression('WSREP: SR rbr write fail.*'); +call mtr.add_suppression('WSREP: Maximum writeset size exceeded by.*'); +call mtr.add_suppression('WSREP: transaction size exceeded.*'); +call mtr.add_suppression('WSREP: fragment replication failed:'); +call mtr.add_suppression('WSREP: post commit failed for SR rollback'); +call mtr.add_suppression('WSREP: pre_commit for SR rollback returned 2, thd:*'); +call mtr.add_suppression('WSREP: wsrep_rollback failed to send SR ROLLBACK for *'); diff --git a/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test b/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test new file mode 100644 index 00000000000..ea40f58db73 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_var_ignore_apply_errors_sr.test @@ -0,0 +1,38 @@ +# +# Test option wsrep_ignore_apply_errors +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Delete row that does not exist using SR transaction +# + +--connection node_2 +SET GLOBAL wsrep_ignore_apply_errors = 2; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +INSERT INTO t1 VALUES (2); +SET GLOBAL wsrep_on = OFF; +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_on = ON; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO t1 VALUES (3); +DELETE FROM t1 WHERE f1 = 1; +DELETE FROM t1 WHERE f1 = 2; +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 1 FROM t1; +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; + +SET SESSION wsrep_trx_fragment_size = 0; +DROP TABLE t1; + +SET GLOBAL wsrep_ignore_apply_errors = 7; +CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); +CALL mtr.add_suppression("Can't find record in 't1'");
\ No newline at end of file diff --git a/mysql-test/suite/galera_sr/t/mdev_18631.cnf b/mysql-test/suite/galera_sr/t/mdev_18631.cnf new file mode 100644 index 00000000000..6fac754e21b --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mdev_18631.cnf @@ -0,0 +1,23 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates +log-bin-compress + +[mysqld.1] +#gtid_domain_id=1 +wsrep_gtid_mode=ON +# Maximum allowed wsrep_gtid_domain_id. +wsrep_gtid_domain_id=4294967295 +wsrep_trx_fragment_size=1 +wsrep_trx_fragment_unit='ROWS' + +[mysqld.2] +#gtid_domain_id=2 +wsrep_gtid_mode=ON +wsrep_gtid_domain_id=4294967295 +wsrep_trx_fragment_size=1 +wsrep_trx_fragment_unit='ROWS' +#wsrep_gitd_domain_id value will be inherited from donor node (mysqld.1) +#wsrep_gitd_domain_id=X diff --git a/mysql-test/suite/galera_sr/t/mdev_18631.test b/mysql-test/suite/galera_sr/t/mdev_18631.test new file mode 100644 index 00000000000..b6a0d85bbd4 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mdev_18631.test @@ -0,0 +1,24 @@ +# +# Test that streaming replication works with wsrep_gtid_mode=ON. +# The configuration is provided in mdev_18631.cnf. +# + + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--echo # On node_1 +--connection node_1 +CREATE TABLE t1(f1 INT PRIMARY KEY) ENGINE=INNODB; + +INSERT INTO t1 VALUES (1), (2), (3); + +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +SELECT * FROM t1; + +DROP TABLE t1; + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test b/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test new file mode 100644 index 00000000000..e3e7411c7ea --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep#215.test @@ -0,0 +1,176 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +# +# Test the following sequence of events: +# +# 1. Node #1 begins a transaction +# 2. Node #2 performs a conflicting insert +# 3. Node #1 attempts to SR-replicate a conflicting transaction +# + +# to sync node_1 appliers +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 2; +SET SESSION wsrep_trx_fragment_unit = 'statements'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_1a +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; + +--connection node_2 +INSERT INTO t1 VALUES (1); + +--connection node_1a +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +SELECT COUNT(*) = 0 FROM t1; +--send INSERT INTO t1 VALUES (1); + +--connection node_1a +# Wait for the above INSERT to fail certification +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc + +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +COMMIT; + +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1a +SET DEBUG_SYNC = 'RESET'; + +# +# Similar test with BYTES unit +# +--connection node_1 +TRUNCATE TABLE t1; + +SET SESSION wsrep_trx_fragment_size = 10; +SET SESSION wsrep_trx_fragment_unit = 'bytes'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_1a +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; + +--connection node_2 +INSERT INTO t1 VALUES (1); + +--connection node_1a +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +SELECT COUNT(*) = 0 FROM t1; +--send INSERT INTO t1 VALUES (1) + +# Wait for the above INSERT to fail certification +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc + +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap +ROLLBACK; + +SELECT * FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT * FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1a +SET DEBUG_SYNC = 'RESET'; + +# +# One more test with BYTES unit, but now fragment size is adjusted so +# that second insert should trigger fragment replication. +# Currently 200 bytes is good choice here, but this may change with +# future MySQL versions. +# => If this test fails after some MySQL merge, check if frgament size +# needs to be tuned to spot at second insert statement. +# +--connection node_1 +TRUNCATE TABLE t1; + +SET SESSION wsrep_trx_fragment_size = 200; +SET SESSION wsrep_trx_fragment_unit = 'bytes'; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--let $expected_cert_failures = `SELECT VARIABLE_VALUE + 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures'` + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +--connection node_1a +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb'; +SET SESSION wsrep_sync_wait = 0; + +--connection node_2 +INSERT INTO t1 VALUES (1); + +--connection node_1a +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +INSERT INTO t1 VALUES (1); +--send INSERT INTO t1 VALUES (2) + +# Wait for the above INSERT to fail certification +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = $expected_cert_failures FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_cert_failures' +--source include/wait_condition.inc + +SET GLOBAL DEBUG_DBUG = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap +COMMIT; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1a +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; + +--connection node_2 +CALL mtr.add_suppression("WSREP: Could not find applier context for"); diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt new file mode 100644 index 00000000000..03fcb5d040d --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136-master.opt @@ -0,0 +1 @@ +--log-slave-updates --log-bin diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test new file mode 100644 index 00000000000..06e56d3c9cd --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#136.test @@ -0,0 +1,41 @@ +# SR transactions are not binlogged #136 + +--source include/galera_cluster.inc + +--connection node_1 +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; + +--connection node_2 +SET GLOBAL wsrep_on=OFF; +RESET MASTER; +SET GLOBAL wsrep_on=ON; + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); +COMMIT; + +SET SESSION wsrep_trx_fragment_size = 0; +INSERT INTO t1 VALUES (3),(4); +COMMIT; + +--connection node_1 +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; + +--connection node_2 +# Wait for all updates to arrive before dumping binlog +SELECT COUNT(*) = 4 FROM t1; + +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 <Pos> 5 <End_log_pos> +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test new file mode 100644 index 00000000000..3694dc9ad43 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#138.test @@ -0,0 +1,25 @@ +# SR: two identical transactions have different value for the WSREP_FLAG_PA_UNSAFE flag + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1),(2); + +--connection node_2 +SELECT flags FROM mysql.wsrep_streaming_log; + +--connection node_1 +ROLLBACK; +INSERT INTO t1 VALUES (3),(4); + +--connection node_2 +SELECT flags FROM mysql.wsrep_streaming_log; + +--connection node_1 +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test new file mode 100644 index 00000000000..deeb890fa0b --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test @@ -0,0 +1,21 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); + +COMMIT; + +DROP TABLE t1; + +--connection node_2 +--source include/galera_wait_ready.inc + diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test new file mode 100644 index 00000000000..e0a443061df --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test @@ -0,0 +1,62 @@ +# statement rollback for SR transaction causes slave crash for inconsistency + +# We test the following: +# 1. Create a transaction that is blocked by an SR transaction +# 2. Force the SR transaction to have a statement rollback +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t2 VALUES (6),(7),(8),(9),(10),(1); + +--connection node_2 +SET GLOBAL wsrep_slave_threads = 2; +SET GLOBAL debug_dbug = 'd,sync.wsrep_apply_cb'; + +# Begin SR transaction +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1), (2), (3), (4), (5); + +# Begin non-SR transaction that will block waiting for the SR transaction +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET AUTOCOMMIT=OFF; +START TRANSACTION; +--send INSERT INTO t1 VALUES (1), (2), (3), (4), (5); + +# Cause the SR transaction to fail with a duplicate key error +--connection node_1 +--send INSERT INTO t1 SELECT * FROM t2; + +# Continue and commit the non-SR transaction. +--connection node_1a +--reap +INSERT INTO t1 VALUES (6), (7), (8), (9), (10); +COMMIT; + +--connection node_1 +--error ER_LOCK_DEADLOCK,ER_DUP_ENTRY +--reap + +--connection node_2 +SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL debug_dbug = ''; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; +SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; + +SELECT COUNT(*) = 10 FROM t1; + +DROP TABLE t1; +DROP TABLE t2; + +SET DEBUG_SYNC = RESET; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test new file mode 100644 index 00000000000..4aaff058b30 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#15.test @@ -0,0 +1,17 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (id INT) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); + +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc new file mode 100644 index 00000000000..7f13afa3c47 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.inc @@ -0,0 +1,109 @@ +# --source include/galera_cluster.inc +# --source include/have_debug_sync.inc + +# +# This test attempts to catch a race condition between autocommit +# transaction and transaction which is rolling back due to +# deadlock. +# +# Test outline: +# * Trx 1a makes updates +# * SR trx 1b writes a row 3, then makes updates +# * AC trx 1c will attempt to write row 3 and will wait for lock +# held by 1b +# * Sync point is set for 1b to delay SR rollback +# * SR trx 1b makes an update which makes it conflict with trx 1a +# * Slave shows BF - BF conflict and fails in applying write event + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(1)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 'x'), (2, 'x'), (4, 'x'), (5, 'x'); + +# --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +# --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +# --connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1a +START TRANSACTION; + +UPDATE t1 SET f2 = 'a' WHERE f1 = 1; +UPDATE t1 SET f2 = 'a' WHERE f1 = 4; +UPDATE t1 SET f2 = 'a' WHERE f1 = 5; + + +--connection node_1b +START TRANSACTION; +SET SESSION wsrep_trx_fragment_size = 1; +INSERT INTO t1 VALUES (3, 'b'); +UPDATE t1 SET f2 = 'b' WHERE f1 = 2; + +--connection node_2 +SELECT * FROM t1; + +# Will block, waiting for 1b +--connection node_1c +SET AUTOCOMMIT=ON; +--send INSERT INTO t1 VALUES (3, 'c') + +--connection node_2 +SELECT * FROM t1; + +# Will block, waiting for 1b +--connection node_1a +--send UPDATE t1 SET f2 = 'a' WHERE f1 = 2 + +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user' AND STATE = 'Updating'; +--source include/wait_condition.inc + +# Will deadlock +--connection node_1b +SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; +--send UPDATE t1 SET f2 = 'b' WHERE f1 = 1 + +# Wait until 1b hits rollback +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR wait'; + +# UPDATE 12.06.2016: as of recent wsrep API changes, rollbacking thread no +# longer queues ROLLBACKs and blocks on ROLLBACK replication before performing +# the actual rollback. As a result this test is moot as both node_1a and node_1c +# connections are hanging now until sync point is released. Thus sync point +# release had to be moved above to release the connections. However it is not +# impossible that further changes in the code may reintroduce the race, so +# leaving the test as close to original as possible. +# +# --connection node_1a +# --reap +# COMMIT; +# +# --connection node_1c +# --reap +# +# UPDATE t1 SET f2 = 'x' WHERE f1 = 3; + +--connection node_1 +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection node_1c +--reap + +UPDATE t1 SET f2 = 'x' WHERE f1 = 3; + +--connection node_1a +--reap +COMMIT; + +--connection node_1b +--error ER_LOCK_DEADLOCK +--reap + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test new file mode 100644 index 00000000000..85d501288b0 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#165.test @@ -0,0 +1,41 @@ +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +# +# This test attempts to catch a race condition between autocommit +# transaction and transaction which is rolling back due to +# deadlock. +# +# Since it is trying to catch a race condition which may not reliably +# occur, several runs are necessary for certainty. Hence the body of +# the test was placed into the .inc file and sourced several times below +# +# Test outline: +# * Trx 1a makes updates +# * SR trx 1b writes a row 3, then makes updates +# * AC trx 1c will attempt to write row 3 and will wait for lock +# held by 1b +# * Sync point is set for 1b to delay SR rollback +# * SR trx 1b makes an update which makes it conflict with trx 1a +# * Slave shows BF - BF conflict and fails in applying write event + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc +--source mysql-wsrep-features#165.inc diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test new file mode 100644 index 00000000000..544109dadee --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test @@ -0,0 +1,47 @@ +# Assertion `total_length + thd->wsrep_fragment_base == saved_pos' failed in wsrep_write_cache_inc() with ROLLBACK TO SAVEPOINT and SR + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER, f2 VARCHAR(10)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +INSERT INTO t1 VALUES (3, 'a'); +INSERT INTO t1 VALUES (4, 'a'); +INSERT INTO t1 VALUES (5, 'a'); +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +SAVEPOINT s1; +INSERT INTO t1 VALUES (11, 'b'); +INSERT INTO t1 VALUES (12, 'b'); +INSERT INTO t1 VALUES (13, 'b'); +INSERT INTO t1 VALUES (14, 'b'); +INSERT INTO t1 VALUES (15, 'b'); + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; +--source include/wait_condition.inc + +--connection node_1 +ROLLBACK TO SAVEPOINT s1; + +INSERT INTO t1 VALUES (21, 'c'); + +COMMIT; + +--connection node_1 +SELECT COUNT(*) = 6 FROM t1; + + +--connection node_2 +SELECT COUNT(*) = 6 FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test new file mode 100644 index 00000000000..f9c09391f8f --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#27.test @@ -0,0 +1,29 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_2 +--sleep 2 +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt new file mode 100644 index 00000000000..a6ef074a120 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32-master.opt @@ -0,0 +1 @@ +--innodb-lock-wait-timeout=1 diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test new file mode 100644 index 00000000000..72c7a7b5e82 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#32.test @@ -0,0 +1,44 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# mysql-wsrep-features#32 Assertion `meta->gtid.seqno == wsrep_thd_trx_seqno(thd)' failed in wsrep_commit_cb with SR +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +SET SESSION wsrep_trx_fragment_size = 1; + +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +SET AUTOCOMMIT=OFF; + +SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; +START TRANSACTION; + +INSERT INTO t1 VALUES (9); +INSERT INTO t1 VALUES (8); +INSERT INTO t1 VALUES (7); +INSERT INTO t1 VALUES (6); + +--error ER_LOCK_WAIT_TIMEOUT +INSERT INTO t1 VALUES (5); +ROLLBACK; + +--connection node_1 +COMMIT; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test new file mode 100644 index 00000000000..f63e1cca70c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#35.test @@ -0,0 +1,48 @@ +--source include/have_debug_sync.inc +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# Block node #2's applier so that it is able to issue a conflicting INSERT before +# node #1 INSERTs have been applied on it. + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +SELECT COUNT(*) = 0 FROM t1; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb'; + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); + +--connection node_2a +SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) = 0 FROM t1; +--send INSERT INTO t1 VALUES (1); + +--connection node_1 +COMMIT; + +--connection node_2a +SET GLOBAL debug_dbug = ''; +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--error ER_DUP_ENTRY,ER_LOCK_DEADLOCK +--reap +ROLLBACK; + +DROP TABLE t1; + +--connection node_2a +SET DEBUG_SYNC = "RESET"; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test new file mode 100644 index 00000000000..55210386044 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#8.test @@ -0,0 +1,63 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# InnoDB FULLTEXT indexes +# + +SET SESSION wsrep_trx_fragment_size = 1; +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +# +# Fulltext index creation causes the creation of multiple system tables +# + +--connection node_1 +CREATE TABLE t1 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 VARCHAR(100), FULLTEXT (f2)) ENGINE=InnoDB; + +--connection node_2 +SELECT COUNT(*) = 13 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name LIKE 'test/%'; + +# +# Fulltext insertion causes a flurry of updates on those system tables +# + +--connection node_1 +# Insert 10K rows +INSERT INTO t1 (f2) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +--connection node_2 +SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('foobarbaz'); + +UPDATE t1 SET f2 = 'abcdefjhk'; + +--connection node_1 +SELECT COUNT(f2) = 10000 FROM t1 WHERE MATCH(f2) AGAINST ('abcdefjhk'); + +--connection node_2 + +DROP TABLE t1; + +# +# Same on a table with no PK +# + +--connection node_1 +CREATE TABLE t1 (f1 VARCHAR(100), FULLTEXT (f1)) ENGINE=InnoDB; + +--connection node_2 +# We insert only 1K rows here, because updates without a PK are very slow +INSERT INTO t1 (f1) SELECT 'foobarbaz' FROM ten AS a1, ten AS a2, ten AS a3; + +--connection node_1 +SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('foobarbaz'); + +UPDATE t1 SET f1 = 'abcdefjhk'; + +--connection node_2 +SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk'); + +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test new file mode 100644 index 00000000000..cbecf40fadf --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#9.test @@ -0,0 +1,44 @@ +# +# mysql-wsrep-features#9 Hang in galera::ReplicatorSMM::cert with Streaming Replication +# when running the galera_kill_ddl.test test +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +--connection node_1 + +# Enable the master to continue running during the split-brain situation that +# occurs when the slave is killed +--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` +SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; + +SET SESSION wsrep_trx_fragment_size = 1; + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +--connection node_2 +--source include/kill_galera.inc + +--connection node_1 +ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_2 +--source include/start_mysqld.inc +--source include/galera_wait_ready.inc + +--let $galera_connection_name = node_2a +--let $galera_server_number = 2 +--source include/galera_connect.inc +--connection node_2a + +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +--connection node_1 +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; +--enable_query_log + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test new file mode 100644 index 00000000000..442a7113537 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#93.test @@ -0,0 +1,29 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# This test sets a SAVEPOINT at the very beginning +# of the transaction. When ROLLBACK TO SAVEPOINT is +# issued, mysql performs a full rollback on SEs that +# where not part of the transaction. +# Test that SR transactions are rolled back, and +# cleaned up properly in this case. +# + +CREATE TABLE t1 (f1 INTEGER); +SET SESSION WSREP_TRX_FRAGMENT_SIZE=1; + +START TRANSACTION; + +SAVEPOINT a; +INSERT INTO t1 VALUES (1); +ROLLBACK TO SAVEPOINT a; + +INSERT INTO t1 values (2); +COMMIT; + +SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log; +--connection node_2 +SELECT COUNT(*) = 0 from mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test new file mode 100644 index 00000000000..c773b310183 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test @@ -0,0 +1,45 @@ +# mysql-wsrep-features#96 - "Sanity check failed" with SR and statement rolled back due to error + +--source include/galera_cluster.inc +--source include/have_innodb.inc + + +--connection node_1 + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +CREATE TABLE t2 (f2 VARCHAR(32)); + +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +# This statement causes full transaction rollback +# rather than just statement rollback, as it is run under SR + +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (2),(1); +INSERT INTO t2 VALUES ('abc'); + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 1 FROM t2; + +--connection node_1 +ROLLBACK; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; + +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM t2; + +--connection node_1 +DROP TABLE t1; +DROP TABLE t2; + + + + |