diff options
Diffstat (limited to 'mysql-test/suite/galera_3nodes_sr')
45 files changed, 3145 insertions, 0 deletions
diff --git a/mysql-test/suite/galera_3nodes_sr/disabled.def b/mysql-test/suite/galera_3nodes_sr/disabled.def new file mode 100644 index 00000000..900b2786 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/disabled.def @@ -0,0 +1,6 @@ +GCF-336 : +GCF-582 : +GCF-810A : +GCF-810B : +GCF-810C : +galera_sr_kill_slave_after_apply_rollback2 :
\ No newline at end of file diff --git a/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf new file mode 100644 index 00000000..62c8214b --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/galera_3nodes.cnf @@ -0,0 +1 @@ +!include ../galera_3nodes/galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes_sr/my.cnf b/mysql-test/suite/galera_3nodes_sr/my.cnf new file mode 100644 index 00000000..bb25b95c --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/my.cnf @@ -0,0 +1 @@ +!include galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result new file mode 100644 index 00000000..bb6c11ed --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-336.result @@ -0,0 +1,26 @@ +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM t1; +COUNT(*) > 0 +1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +INSERT INTO t1 VALUES (2); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +COMMIT; +ERROR 08S01: WSREP has not yet prepared node for application use +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +DROP TABLE t1; +CALL mtr.add_suppression("replication aborted"); +CALL mtr.add_suppression("WSREP: fragment replication failed: 3"); +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result new file mode 100644 index 00000000..9e2a4823 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-582.result @@ -0,0 +1,23 @@ +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); +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +5 +COMMIT; +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +SELECT COUNT(*) FROM t1; +COUNT(*) +5 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result new file mode 100644 index 00000000..775f7ee0 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-606.result @@ -0,0 +1,38 @@ +connection node_2; +connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); +connection node_1; +connection node_2a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +SET WSREP_ON=ON; +connection node_1; +connection node_2a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_1; +connection node_1; +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +0 +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM t1; +f1 +COMMIT; +connection node_1; +SELECT * FROM t1; +f1 +DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result new file mode 100644 index 00000000..db7da93c --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-609.result @@ -0,0 +1,78 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +connection node_1; +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +connection node_2; +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +ERROR 23000: Duplicate entry '11' for key 'PRIMARY' +INSERT INTO t1 VALUES (31),(32),(33); +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +0 +connection node_1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +0 +COMMIT; +connection node_2; +COMMIT; +SELECT * FROM t1; +f1 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +31 +32 +33 +connection node_1; +SELECT * FROM t1; +f1 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +31 +32 +33 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result new file mode 100644 index 00000000..9a83ff3c --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810A.result @@ -0,0 +1,256 @@ +SET GLOBAL debug="d,crash_last_fragment_commit_before_fragment_removal"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +crash_last_fragment_commit_before_fragment_removal +COMMIT; +Got one of the listed errors +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +SET GLOBAL debug="d,crash_last_fragment_commit_after_fragment_removal"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +crash_last_fragment_commit_after_fragment_removal +COMMIT; +Got one of the listed errors +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +SET GLOBAL debug="d,crash_replicate_fragment_success"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +crash_replicate_fragment_success +COMMIT; +Got one of the listed errors +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +SET GLOBAL debug="d,crash_replicate_fragment_after_certify"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +crash_replicate_fragment_after_certify +COMMIT; +Got one of the listed errors +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +SET GLOBAL debug="d,crash_replicate_fragment_before_certify"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +crash_replicate_fragment_before_certify +COMMIT; +Got one of the listed errors +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result new file mode 100644 index 00000000..bbec3531 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810B.result @@ -0,0 +1,100 @@ +SET GLOBAL debug="d,crash_apply_cb_before_append_frag"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +SET GLOBAL debug="d,crash_apply_cb_after_append_frag"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +COMMIT; +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +COMMIT; +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug = ''; +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result new file mode 100644 index 00000000..1a6dcbfd --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-810C.result @@ -0,0 +1,177 @@ +SET GLOBAL debug="d,crash_commit_cb_last_fragment_commit_success"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); +SELECT 1 FROM t1; +Got one of the listed errors +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug="d,crash_commit_cb_before_last_fragment_commit"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); +SELECT 1 FROM t1; +Got one of the listed errors +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug="d,crash_apply_cb_after_fragment_removal"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); +SELECT 1 FROM t1; +Got one of the listed errors +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET GLOBAL debug="d,crash_apply_cb_before_fragment_removal"; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (f1 VARCHAR(10)) ENGINE = InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('secondary'),('secondary'),('secondary'),('secondary'),('secondary'); +SET SESSION wsrep_trx_fragment_size=1; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'),('primary'); +SELECT 1 FROM t1; +Got one of the listed errors +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT * FROM mysql.wsrep_streaming_log; +node_uuid trx_id seqno flags frag +SELECT COUNT(*) > 0 FROM t1 WHERE f1 = 'primary'; +COUNT(*) > 0 +1 +SELECT COUNT(*) = 0 FROM t1 WHERE f1 = 'secondary'; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result new file mode 100644 index 00000000..4eb0ebca --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-817.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +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); +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_on = OFF; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +connection node_3; +connection node_1a; +connection node_1a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +connection node_3; +connection node_1a; +connection node_2; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +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_2; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result new file mode 100644 index 00000000..8333fff9 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; +CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +COMMIT; +ERROR HY000: Lost connection to MySQL server during query +# restart +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 t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result new file mode 100644 index 00000000..bb4eb829 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_isolate_master.result @@ -0,0 +1,80 @@ +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); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM t1; +COUNT(*) > 0 +1 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_2; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_2; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_3; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +connection node_1a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_2; +connection node_3; +connection node_1a; +connection node_1; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +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); +COMMIT; +connection node_2; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_3; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_1; +CALL mtr.add_suppression("failed to send SR rollback for"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result new file mode 100644 index 00000000..dbdd95f8 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_join_slave.result @@ -0,0 +1,40 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) 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); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +connection node_2; +# restart +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); +COMMIT; +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +1 +connection node_2; +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +1 +connection node_3; +SELECT COUNT(*) = 10 FROM t1; +COUNT(*) = 10 +1 +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result new file mode 100644 index 00000000..4547d06d --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_master.result @@ -0,0 +1,34 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +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_3; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +connection node_2; +Killing server ... +connection node_3; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +INSERT INTO t1 VALUES (1); +connection node_2; +# restart +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result new file mode 100644 index 00000000..db04c24b --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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; +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); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log; +COUNT(*) = 15 +1 +connection node_1; +COMMIT; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 15 FROM t1; +COUNT(*) = 15 +1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +DROP TABLE t1; +connection node_3; +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result new file mode 100644 index 00000000..ff9215cf --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback.result @@ -0,0 +1,59 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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; +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); +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log; +COUNT(*) = 15 +1 +connection node_1; +ROLLBACK; +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 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +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_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result new file mode 100644 index 00000000..21e301ed --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_after_apply_rollback2.result @@ -0,0 +1,31 @@ +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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); +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +Killing server ... +INSERT INTO t1 VALUES (6); +ROLLBACK; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +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 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +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_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result new file mode 100644 index 00000000..e9dc5518 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result @@ -0,0 +1,45 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +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 ... +# restart +connection node_1; +COMMIT; +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +connection node_2; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +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_3nodes_sr/r/galera_sr_threeway_split.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result new file mode 100644 index 00000000..1a50bace --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split.result @@ -0,0 +1,117 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +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 (10); +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (200); +INSERT INTO t1 VALUES (201); +INSERT INTO t1 VALUES (202); +INSERT INTO t1 VALUES (203); +INSERT INTO t1 VALUES (204); +connection node_3; +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (300); +INSERT INTO t1 VALUES (301); +INSERT INTO t1 VALUES (302); +INSERT INTO t1 VALUES (303); +INSERT INTO t1 VALUES (304); +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1a; +connection node_2a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_3a; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1a; +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); +connection node_2a; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_3a; +SET SESSION wsrep_on = ON; +SET SESSION wsrep_sync_wait = 15; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +connection node_1a; +connection node_2a; +connection node_3a; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +wsrep_gcomm_uuid_match +1 +connection node_3; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +COUNT(DISTINCT node_uuid) = 1 +1 +wsrep_gcomm_uuid_match +1 +connection node_1; +INSERT INTO t1 VALUES (30); +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (33); +INSERT INTO t1 VALUES (34); +COMMIT; +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34 +1 1 1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=ON; +connection node_2; +COMMIT; +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34 +1 1 1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=ON; +connection node_3; +COMMIT; +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +COUNT(*) = 15 MIN(f1) = 10 MAX(f1) = 34 +1 1 1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COUNT(*) = 0 +1 +SET AUTOCOMMIT=ON; +DROP TABLE t1; +connection node_1; +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +connection node_2; +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +connection node_3; +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split_no_primary.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split_no_primary.result new file mode 100644 index 00000000..c634bac9 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_threeway_split_no_primary.result @@ -0,0 +1,85 @@ +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; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +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 (21); +INSERT INTO t1 VALUES (22); +connection node_3; +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); +connection node_2a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +connection node_3a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +connection node_1a; +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SET SESSION wsrep_sync_wait = DEFAULT; +connection node_2a; +SET SESSION wsrep_sync_wait = 0; +SHOW STATUS LIKE 'wsrep_cluster_status'; +Variable_name Value +wsrep_cluster_status non-Primary +SET SESSION wsrep_sync_wait = DEFAULT; +connection node_3a; +SET SESSION wsrep_sync_wait = 0; +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'; +connection node_3a; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +connection node_1a; +connection node_2a; +connection node_3a; +connection node_1a; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +INSERT INTO t1 VALUES(11); +INSERT INTO t1 VALUES(21); +INSERT INTO t1 VALUES(31); +SELECT * FROM t1; +f1 +11 +21 +31 +connection node_2a; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +connection node_3a; +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +expect 0 +0 +connection node_1; +INSERT INTO t1 VALUES(103); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_2; +INSERT INTO t1 VALUES(203); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_3; +INSERT INTO t1 VALUES(303); +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result b/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result new file mode 100644 index 00000000..678cfe4c --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_vote_sr.result @@ -0,0 +1,197 @@ +connection node_2; +connection node_1; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connection node_1; +connection node_2; +connection node_3; +Inconsistency on the first fragment +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_on=OFF; +INSERT INTO t1 VALUES (1, 'X'); +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; +connection node_1; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 16384; +START TRANSACTION; +INSERT INTO t1 VALUES (1, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (2, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (3, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (4, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (5, REPEAT('A', 16384)); +COMMIT; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +START TRANSACTION; +INSERT INTO t1 VALUES (11, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (12, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (13, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (14, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (15, REPEAT('A', 16384)); +connection node_2; +SET SESSION wsrep_on=OFF; +Starting mysqld +# restart +connection node_1; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +COMMIT; +connection node_1; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_3; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_1; +DROP TABLE t1; +Inconsistency on a middle fragment +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_on=OFF; +INSERT INTO t1 VALUES (3, 'X'); +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; +connection node_1; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 16384; +START TRANSACTION; +INSERT INTO t1 VALUES (1, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (2, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (3, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (4, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (5, REPEAT('A', 16384)); +COMMIT; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +START TRANSACTION; +INSERT INTO t1 VALUES (11, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (12, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (13, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (14, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (15, REPEAT('A', 16384)); +connection node_2; +SET SESSION wsrep_on=OFF; +Starting mysqld +# restart +connection node_1; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +COMMIT; +connection node_1; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_3; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_1; +DROP TABLE t1; +Inconsistency on the commit fragment +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_on=OFF; +INSERT INTO t1 VALUES (5, 'X'); +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; +connection node_1; +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size = 16384; +START TRANSACTION; +INSERT INTO t1 VALUES (1, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (2, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (3, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (4, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (5, REPEAT('A', 16384)); +COMMIT; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +START TRANSACTION; +INSERT INTO t1 VALUES (11, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (12, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (13, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (14, REPEAT('A', 16384)); +INSERT INTO t1 VALUES (15, REPEAT('A', 16384)); +connection node_2; +SET SESSION wsrep_on=OFF; +Starting mysqld +# restart +connection node_1; +connection node_2; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +COUNT(*) > 0 +1 +connection node_1; +COMMIT; +connection node_1; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_2; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_3; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +expect_0 +0 +SELECT COUNT(*) AS expect_10 FROM t1; +expect_10 +10 +connection node_1; +DROP TABLE t1; +connection node_2; +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '3' for key 'PRIMARY'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '5' for key 'PRIMARY'"); +CALL mtr.add_suppression("Write_rows_v1 apply failed"); +CALL mtr.add_suppression("Inconsistent by consensus"); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); +CALL mtr.add_suppression("WSREP: Failed to report last committed"); diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm new file mode 100644 index 00000000..a65c2b5d --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -0,0 +1,44 @@ +package My::Suite::GALERA_3NODES_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: SQL statement was ineffective), + 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: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.), + qr(WSREP: Could not find peer:), + 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: Action message in non-primary configuration from member [0-9]*), + 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.), + ); + +bless { }; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test new file mode 100644 index 00000000..b8d46db7 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-336.test @@ -0,0 +1,47 @@ +--source include/galera_cluster.inc + +--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); + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM t1; + +--connection node_2a +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; + +--connection node_2 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES (2); +--error ER_UNKNOWN_COM_ERROR +COMMIT; + +--connection node_2a +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc +DROP TABLE t1; + +CALL mtr.add_suppression("replication aborted"); +CALL mtr.add_suppression("WSREP: fragment replication failed: 3"); +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_3 +--source include/galera_wait_ready.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test new file mode 100644 index 00000000..bf19ea84 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-582.test @@ -0,0 +1,39 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +--source include/shutdown_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 + +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 +--source include/start_mysqld.inc +--source include/wait_until_connected_again.inc +--source include/galera_wait_ready.inc + +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COMMIT; +SELECT COUNT(*) FROM t1; + +--connection node_2 +SELECT COUNT(*) FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test new file mode 100644 index 00000000..6d49247a --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test @@ -0,0 +1,80 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the case where the cluster splits 3 ways. +# The master transitions to a non-prim view and back to prim. Its ongoing +# should fail to commit. +# + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +--connection node_2 +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); + +--connection node_1 +--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +# +# Isolate node_2 into a separate non-primary component +# + +--connection node_2a +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +--disable_query_log +SET WSREP_ON=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SET WSREP_ON=ON; +--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 + +# +# Confirm that node_1 has no transactions in SR table +# + +--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +# +# Restore cluster +# + +--connection node_2a +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +--source include/galera_wait_ready.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_1 +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; +SELECT * FROM t1; +COMMIT; + +--connection node_1 +SELECT * FROM t1; + +DROP TABLE t1; + +--connection node_2 +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test new file mode 100644 index 00000000..210b100a --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-609.test @@ -0,0 +1,37 @@ +# +# GCF-609 SR: Assertion wsrep_apply_cb on slave after master causes a duplicate key error +# + +--source include/galera_cluster.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_1 +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +--connection node_2 +SET SESSION wsrep_trx_fragment_size=1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); +INSERT INTO t1 VALUES (31),(32),(33); + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +COMMIT; + +--connection node_2 +COMMIT; +SELECT * FROM t1; + +--connection node_1 +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test new file mode 100644 index 00000000..fda16b72 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test @@ -0,0 +1,137 @@ +# +# Exercise the crash points which crash the server at various points important to SR +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# +# crash_last_fragment_commit_before_fragment_removal +# + +--connection node_2 +--enable_reconnect +SET GLOBAL debug_dbug="d,crash_last_fragment_commit_before_fragment_removal"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +--echo crash_last_fragment_commit_before_fragment_removal + +--connection node_2 +--error 2006,2013 +COMMIT; + +--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 + +--connection node_2 +--source include/start_mysqld.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + +# +# crash_last_fragment_commit_after_fragment_removal +# + +--connection node_2 +SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +--echo crash_last_fragment_commit_after_fragment_removal + +--connection node_2 +--error 2006,2013 +COMMIT; + +--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 + +--connection node_2 +--source include/start_mysqld.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + +# +# crash_last_fragment_commit_success +# +# Case crash_last_fragment_commit_success is commented out, +# the changes will be visible on slave due to succesful commit, +# so the galera_sr_crash_post_check will fail. +# + +# --connection node_2 +# SET GLOBAL debug_dbug="d,crash_last_fragment_commit_success"; +# --source suite/galera_3nodes/include/galera_expect_node_crash.inc +# --source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +# --echo crash_last_fragment_commit_success + +# --connection node_2 +# --error 2006,2013 +# COMMIT; + +# --source include/start_mysqld.inc +# --source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + +# +# crash_replicate_fragment_success +# + +--connection node_2 +SET GLOBAL debug_dbug="d,crash_replicate_fragment_success"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +--echo crash_replicate_fragment_success + +--connection node_2 +--error 2006,2013 +COMMIT; + +--source include/start_mysqld.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + +# +# crash_replicate_fragment_after_certify +# + +--connection node_2 +SET GLOBAL debug_dbug="d,crash_replicate_fragment_after_certify"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +--echo crash_replicate_fragment_after_certify + +--connection node_2 +--error 2006,2013 +COMMIT; + +--source include/start_mysqld.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + +# +# crash_replicate_fragment_before_certify +# + +--connection node_2 +SET GLOBAL debug_dbug="d,crash_replicate_fragment_before_certify"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes.inc + +--echo crash_replicate_fragment_before_certify + +--connection node_2 +--error 2006,2013 +COMMIT; + +--source include/start_mysqld.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check.inc + + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test new file mode 100644 index 00000000..cb41b234 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test @@ -0,0 +1,49 @@ +# +# Exercise the crash points which crash the server at various points important to SR +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# +# crash_apply_cb_before_append_frag +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_apply_cb_before_append_frag"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc + +--connection node_3 +--error 0,2006,2013 +COMMIT; + +--source include/start_mysqld.inc +--sleep 5 +--source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc + +# +# crash_apply_cb_after_append_frag +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_apply_cb_after_append_frag"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes2.inc + +--connection node_3 +--error 0,2006,2013 +COMMIT; + +--source include/start_mysqld.inc +--sleep 5 +--source suite/galera_3nodes/include/galera_sr_crash_post_check2.inc + +--connection node_1 +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test new file mode 100644 index 00000000..6c4da2cb --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test @@ -0,0 +1,70 @@ +# +# Exercise the crash points which crash the server at various points important to SR +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_2_check, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--enable_reconnect +--connect node_3_check, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# +# crash_commit_cb_last_fragment_commit_success +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_commit_cb_last_fragment_commit_success"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc + +--source include/start_mysqld.inc +--sleep 5 +--source include/galera_wait_ready.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc + +# +# crash_commit_cb_before_last_fragment_commit +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_commit_cb_before_last_fragment_commit"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc + +--source include/start_mysqld.inc +--sleep 5 +--source include/galera_wait_ready.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc + +# +# crash_apply_cb_after_fragment_removal +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_apply_cb_after_fragment_removal"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc + +--source include/start_mysqld.inc +--sleep 5 +--source include/galera_wait_ready.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc + +# +# crash_apply_cb_before_fragment_removal +# + +--connection node_3 +SET GLOBAL debug_dbug="d,crash_apply_cb_before_fragment_removal"; +--source suite/galera_3nodes/include/galera_expect_node_crash.inc +--source suite/galera_3nodes/include/galera_sr_crash_prepare_nodes3.inc + +--source include/start_mysqld.inc +--sleep 5 +--source include/galera_wait_ready.inc +--source suite/galera_3nodes/include/galera_sr_crash_post_check3.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test new file mode 100644 index 00000000..a32da959 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test @@ -0,0 +1,109 @@ +# +# GCF-817 SR: master removes SR trx in non-primary view +# + +--source include/galera_cluster.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--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); +INSERT INTO t1 VALUES (6); +INSERT INTO t1 VALUES (7); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait = 0; +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--connection node_1a +# Force node #1 to go non-primary +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; + +SET SESSION wsrep_on = OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# SR table on master should still contain entries after going non-Prim +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# SR table on slave should eventually clean up entries when master goes non-Prim +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# Restore node #1 to primary + +--connection node_1a +# +# The following sleep is a workaround for issue GCF-861. +# Normally it's sufficient to make sure that the CC happened +# by checking that wsrep_cluster_size has shrinked, as above. +# However that is not always enough, so we sleep a few seconds. +# See GCF-861 on how to reproduce. +# + +--connection node_1a +--sleep 6 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--source include/galera_wait_ready.inc + +# SR table on master should contain no entries after going back to Prim state +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +--connection node_2 +# And none on slave +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +# SR table is now empty everywhere +--connection node_1a +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test new file mode 100644 index 00000000..eb7f5603 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -0,0 +1,43 @@ +# +# GCF-832 SR: mysql.wsrep_streaming_log table remains populated on all nodes after crash +# followed by immediate recovery +# +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; + +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--exec echo "wait" > $_expect_file_name + +CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; + +SET AUTOCOMMIT=OFF; +SET SESSION wsrep_trx_fragment_size=1; +START TRANSACTION; + +INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +--error 2013 +COMMIT; + +--source include/start_mysqld.inc + +--connection node_1 +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--enable_reconnect +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test new file mode 100644 index 00000000..30fd0192 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test @@ -0,0 +1,127 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the effect of gmcast.isolate on master during an SR transaction +# + +--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); + +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) > 0 FROM t1; + +# +# Trigger gmcast.isolate=1 . +# The transaction is aborted and we expect the SR tables to be cleaned up +# + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +# +# Expect that the transaction is cleaned up entirely across the cluster and in all mysql.wsrep_streaming_log tables +# + +--connection node_2 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +--connection node_3 +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 0 FROM t1; + +# +# Restore cluster +# + +--connection node_1a +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +--connection node_1a +--source include/galera_wait_ready.inc + +# +# Confirm that the previous transaction is gone on Node #1 as well +# + +--connection node_1 +--error ER_LOCK_DEADLOCK +COMMIT; + +SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; + +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# +# Confirm that the transaction can be retried +# + +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; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc +SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +CALL mtr.add_suppression("failed to send SR rollback for"); +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test new file mode 100644 index 00000000..95aa1a37 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test @@ -0,0 +1,59 @@ +# +# This test kills the slave before a Streaming Replication transaction has started +# and restarts it when the transaction is already in progress. IST should +# bring the slave up to date so that it can receive the complete transaction. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connection node_1 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +--connection node_2 +--source include/shutdown_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 + +--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 +--source include/start_mysqld.inc + +--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); +COMMIT; +SELECT COUNT(*) = 10 FROM t1; + +--connection node_2 +SELECT COUNT(*) = 10 FROM t1; + +--connection node_3 +SELECT COUNT(*) = 10 FROM t1; + +--connection node_1 +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test new file mode 100644 index 00000000..c7e75286 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test @@ -0,0 +1,58 @@ +# +# This test kills the master while a Streaming Replication transaction is in progress +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--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_3 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; +--source include/wait_condition.inc + +--connection node_2 +--source include/kill_galera.inc + +--connection node_3 +# We expect that uncommitted values are no longer present + +--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +# and we can insert them again +INSERT INTO t1 VALUES (1); + +--connection node_2 +--source include/start_mysqld.inc + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) = 1 FROM t1; + +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test new file mode 100644 index 00000000..270af538 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply.test @@ -0,0 +1,81 @@ +# +# This test kills the slave while a Streaming Replication transaction is in progress +# and after 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 + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--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; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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 + +--source include/kill_galera.inc + +--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 + +--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); + +--connection node_2 + +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 15 FROM t1; +--source include/wait_condition.inc + +SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log; + +--connection node_1 +COMMIT; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 15 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +--connection node_3 +CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member"); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test new file mode 100644 index 00000000..c0df6b27 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test @@ -0,0 +1,80 @@ +# +# This test kills the slave while a Streaming Replication transaction is in progress +# and after a fragment has already been applied on the slave. It is expected that +# after the slave restarts, the cluster will continue to be consistent even if ROLLBACK +# is issued on the SR transaction after restart. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--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; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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 + +--source include/kill_galera.inc + +--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 + +--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); + +--connection node_2 + +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +--let $wait_condition = SELECT COUNT(*) = 15 FROM t1; +--source include/wait_condition.inc + +SELECT COUNT(*) = 15 FROM mysql.wsrep_streaming_log; + +--connection node_1 +ROLLBACK; + +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; + +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test new file mode 100644 index 00000000..83964769 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -0,0 +1,56 @@ +# +# This test kills the slave while a Streaming Replication transaction is in progress +# and after 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 + +--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; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +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 + +--source include/kill_galera.inc +--sleep 1 + +--connection node_1 +INSERT INTO t1 VALUES (6); +ROLLBACK; + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--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_2 + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test new file mode 100644 index 00000000..92566fa6 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -0,0 +1,73 @@ +# +# 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 + + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +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 +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 +--source include/kill_galera.inc +--source include/start_mysqld.inc + +# Expect that the SR table will get some entries after the restart +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; +--source include/wait_condition.inc + +--connection node_1 +COMMIT; +SELECT COUNT(*) = 5 FROM t1; + +--connection node_2 +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; + +--connection node_1 +DROP TABLE t1; +DROP TABLE t2; + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf new file mode 100644 index 00000000..910d9459 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf @@ -0,0 +1,5 @@ +!include ../galera_3nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=3' + diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test new file mode 100644 index 00000000..62122fe4 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test @@ -0,0 +1,177 @@ +# +# Test the case where the cluster splits 3 ways . The master remains in the +# primary component and is able to commit its transaction. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +# +# Begin a separate SR transaction on every node and confirm that each node +# has SR table entries for every transaction +# + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; + +INSERT INTO t1 VALUES (10); +INSERT INTO t1 VALUES (11); +INSERT INTO t1 VALUES (12); +INSERT INTO t1 VALUES (13); +INSERT INTO t1 VALUES (14); + +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (200); +INSERT INTO t1 VALUES (201); +INSERT INTO t1 VALUES (202); +INSERT INTO t1 VALUES (203); +INSERT INTO t1 VALUES (204); + +--connection node_3 +--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 2 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +SET SESSION wsrep_trx_fragment_size = 1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (300); +INSERT INTO t1 VALUES (301); +INSERT INTO t1 VALUES (302); +INSERT INTO t1 VALUES (303); +INSERT INTO t1 VALUES (304); + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +--connection node_1a +--let $wait_condition = SELECT COUNT(DISTINCT node_uuid) = 3 FROM mysql.wsrep_streaming_log +--source include/wait_condition.inc + +# +# Isolate nodes #2 and #3 into separate non-primary components +# + +--connection node_2a +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_3a +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +INSERT INTO t1 VALUES (20); +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); +INSERT INTO t1 VALUES (23); +INSERT INTO t1 VALUES (24); + +# +# Restore cluster +# + +--connection node_2a +--source include/wsrep_wait_disconnect.inc +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +--source include/galera_wait_ready.inc + +--connection node_3a +--source include/wsrep_wait_disconnect.inc +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +--source include/galera_wait_ready.inc + +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--let $node_1_gcomm_uuid = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_gcomm_uuid'` + +--connection node_2a +--source include/wait_condition.inc + +--connection node_3a +--source include/wait_condition.inc + + +# +# Confirm that the rejoined nodes only have node #1's transaction in their SR tables +# + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +--disable_query_log +--eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log; +--enable_query_log + +--connection node_3 +--error ER_LOCK_DEADLOCK +COMMIT; +SELECT COUNT(DISTINCT node_uuid) = 1 FROM mysql.wsrep_streaming_log; +--disable_query_log +--eval SELECT DISTINCT node_uuid = '$node_1_gcomm_uuid' AS wsrep_gcomm_uuid_match FROM mysql.wsrep_streaming_log; +--enable_query_log + +# +# Finalize transaction on node #1 +# + +--connection node_1 +INSERT INTO t1 VALUES (30); +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); +INSERT INTO t1 VALUES (33); +INSERT INTO t1 VALUES (34); +COMMIT; + +# +# Confirm that transaction is replicated correctly and SR tables are empty at the end of the test +# + +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SET AUTOCOMMIT=ON; + +--connection node_2 +COMMIT; +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SET AUTOCOMMIT=ON; + +--connection node_3 +COMMIT; +SELECT COUNT(*) = 15, MIN(f1) = 10, MAX(f1) = 34 FROM t1; +SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SET AUTOCOMMIT=ON; + +DROP TABLE t1; + +--connection node_1 +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +--connection node_2 +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); +--connection node_3 +CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); + +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split_no_primary.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split_no_primary.test new file mode 100644 index 00000000..f9aab831 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split_no_primary.test @@ -0,0 +1,126 @@ +# +# 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 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--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 (11); +INSERT INTO t1 VALUES (12); + +--connection node_2 +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (21); +INSERT INTO t1 VALUES (22); + +--connection node_3 +SET SESSION wsrep_trx_fragment_size=1; +BEGIN; +INSERT INTO t1 VALUES (31); +INSERT INTO t1 VALUES (32); + +--connection node_2a +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; + +--connection node_3a +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; + +--connection node_1a +# wait until cluster is partitioned +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SET SESSION wsrep_sync_wait = DEFAULT; + +--connection node_2a +# wait until cluster is partitioned +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +SHOW STATUS LIKE 'wsrep_cluster_status'; +SET SESSION wsrep_sync_wait = DEFAULT; + +--connection node_3a +# wait until cluster is partitioned +SET SESSION wsrep_sync_wait = 0; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +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'; + +--connection node_3a +# reconnect node 3 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; + +# wait for the cluster to whole again +--connection node_1a +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connection node_2a +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connection node_3a +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--source include/galera_wait_ready.inc + +--connection node_1a +# 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(11); +INSERT INTO t1 VALUES(21); +INSERT INTO t1 VALUES(31); +SELECT * FROM t1; + +--connection node_2a +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; +--connection node_3a +SELECT COUNT(*) `expect 0` FROM mysql.wsrep_streaming_log; + + +# check that all 3 SRs have been rolled back +--connection node_1 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES(103); + +--connection node_2 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES(203); + +--connection node_3 +--error ER_LOCK_DEADLOCK +INSERT INTO t1 VALUES(303); + +--connection node_1 +DROP TABLE t1; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt new file mode 100644 index 00000000..196498bb --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt @@ -0,0 +1,2 @@ +--wsrep-ignore-apply-errors=0 + diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc new file mode 100644 index 00000000..776291cc --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc @@ -0,0 +1,80 @@ +# +# set $inconsistent_fragment to determine at which fragment inconsistency +# happens +# + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB; + +# Introduce inconsistency +--connection node_2 +SET SESSION wsrep_on=OFF; +--eval INSERT INTO t1 VALUES ($inconsistent_fragment, 'X') +SET SESSION wsrep_on=ON; +DELETE FROM t1 WHERE f1 = 2; + +# Perform an SR transaction that will hit the inconsistency +--connection node_1 +--let $fragment_size = 16384 +SET AUTOCOMMIT=OFF; +--eval SET SESSION wsrep_trx_fragment_size = $fragment_size +START TRANSACTION; +--eval INSERT INTO t1 VALUES (1, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (2, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (3, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (4, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (5, REPEAT('A', $fragment_size)) +COMMIT; +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; + +# Perform another SR transaction in order to have stuff in the +# wsrep_streaming_log table +START TRANSACTION; +--eval INSERT INTO t1 VALUES (11, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (12, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (13, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (14, REPEAT('A', $fragment_size)) +--eval INSERT INTO t1 VALUES (15, REPEAT('A', $fragment_size)) + +# Node #2 has dropped from the cluster due to voting +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +# Bring node #2 back via SST +--connection node_2 +SET SESSION wsrep_on=OFF; +--source include/shutdown_mysqld.inc +--source include/wait_until_disconnected.inc +--echo Starting mysqld +--source include/start_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +# Node #2 should have some entries in its SR table post-restart +SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; + +# Commit second SR transaction +--connection node_1 +COMMIT; + +# Confirm that all nodes are identical +--connection node_1 +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS expect_10 FROM t1; + +--connection node_2 +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS expect_10 FROM t1; + +--connection node_3 +SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS expect_10 FROM t1; + +--connection node_1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test new file mode 100644 index 00000000..bae7d851 --- /dev/null +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.test @@ -0,0 +1,39 @@ +# +# Test voting while an SR transaction is in progress +# + +--source include/galera_cluster.inc +--source include/big_test.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--echo Inconsistency on the first fragment +--let $inconsistent_fragment=1 +--source galera_vote_sr.inc + +--echo Inconsistency on a middle fragment +--let $inconsistent_fragment=3 +--source galera_vote_sr.inc + +--echo Inconsistency on the commit fragment +--let $inconsistent_fragment=5 +--source galera_vote_sr.inc + +--connection node_2 +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '3' for key 'PRIMARY'"); +CALL mtr.add_suppression("Slave SQL: Could not execute Write_rows event on table test.t1; Duplicate entry '5' for key 'PRIMARY'"); +CALL mtr.add_suppression("Write_rows_v1 apply failed"); +CALL mtr.add_suppression("Inconsistent by consensus"); +CALL mtr.add_suppression("WSREP: Failed to apply write set: "); +#CALL mtr.add_suppression("no THD for trx"); +CALL mtr.add_suppression("WSREP: Failed to report last committed"); + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc |