mirror of
https://github.com/MariaDB/server.git
synced 2026-01-27 05:49:07 +01:00
Every Wsrep system thread should run with READ_COMMITTED transaction isolation level to prevent issues caused by InnoDB gap locks. The exception is statement-based replication for appliers, where REPEATABLE_READ is required by the server code. To account for that, set the isolation level before every applied event. It won't affect an already running transaction, but allows to handle both statement- and row-based replications accordingly. However, the problem might arise with the mixed replication format. Apart from that, there was a separate issue with applier thread vars: wsrep_plugins_post_init() would overwrite thd->variables for every applier thread and forget to restore proper default isolation level. Then, upon every server transaction termination, trans_reset_one_shot_statistics() would set thread's isolation level to the one stored in thd->variables, thus spoiling the isolation level value for appliers.
49 lines
1.3 KiB
Text
49 lines
1.3 KiB
Text
##
|
|
## Test that mixed binlog replication works at the applier side.
|
|
##
|
|
|
|
--source include/galera_cluster.inc
|
|
--source include/have_innodb.inc
|
|
|
|
--connection node_2
|
|
--disable_query_log
|
|
call mtr.add_suppression("Unsafe statement written to the binary log");
|
|
--enable_query_log
|
|
|
|
--connection node_1
|
|
--disable_query_log
|
|
call mtr.add_suppression("Unsafe statement written to the binary log");
|
|
--enable_query_log
|
|
|
|
CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
|
|
|
# Try mixed replication: statement then row.
|
|
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
|
|
START TRANSACTION;
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
SET GLOBAL wsrep_forced_binlog_format='ROW';
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
COMMIT;
|
|
|
|
# Try mixed replication: row then statement.
|
|
SET GLOBAL wsrep_forced_binlog_format='ROW';
|
|
START TRANSACTION;
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
SET GLOBAL wsrep_forced_binlog_format='STATEMENT';
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
INSERT INTO t1(i) VALUES(NULL);
|
|
COMMIT;
|
|
|
|
SELECT * FROM t1 ORDER BY i;
|
|
|
|
--connection node_2
|
|
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
|
|
--source include/wait_condition.inc
|
|
SELECT * FROM t1 ORDER BY i;
|
|
|
|
--connection node_1
|
|
SET GLOBAL wsrep_forced_binlog_format='NONE';
|
|
DROP TABLE t1;
|