diff options
Diffstat (limited to 'mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test')
-rw-r--r-- | mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test new file mode 100644 index 00000000000..74350faf5a2 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/galera_sr_rollback_statement.test @@ -0,0 +1,61 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# +# Test the case where a statement is rolled back due to an error while Streaming Replication +# is in effect. We construct an INSERT ... SELECT statement that will fail with a duplicate +# key error towards the end of the statement, after a portion has already been replicated via SR. +# + +--disable_query_log +--let $auto_increment_offset_orig = `SELECT @@auto_increment_offset` +SET GLOBAL auto_increment_offset=1; +--enable_query_log + +--connection node_1 +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) ENGINE=InnoDB; + +INSERT INTO t1 (f2) SELECT REPEAT('a', 255) FROM ten AS a1, ten AS a2, ten AS a3; +ALTER TABLE t1 CHANGE f1 f1 INTEGER; +ALTER TABLE t1 DROP PRIMARY KEY; + +# This poison value is used to cause the INSERT ... SELECT below to fail +INSERT INTO t1 VALUES (1, 'abc'); + + +--let $wsrep_trx_fragment_size_orig = `SELECT @@wsrep_trx_fragment_size` +SET SESSION wsrep_trx_fragment_size = 1; + +--error ER_DUP_ENTRY +INSERT INTO t2 SELECT * FROM t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM t2; +--source include/wait_condition.inc + +# Cluster continues to operate after the implicit ROLLBACK; +--connection node_1 +INSERT INTO t2 VALUES (1, 'abc'); + +--connection node_2 +INSERT INTO t2 VALUES (2, 'abc'); + +--connection node_1 +SELECT COUNT(*) = 2 FROM t2; + +--connection node_2 +SELECT COUNT(*) = 2 FROM t2; + +--connection node_1 + +--disable_query_log +--eval SET GLOBAL auto_increment_offset=$auto_increment_offset_orig; +--enable_query_log + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE ten; |