mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-6676: Optimistic parallel replication
Implement a new mode for parallel replication. In this mode, all transactions are optimistically attempted applied in parallel. In case of conflicts, the offending transaction is rolled back and retried later non-parallel. This is an early-release patch to facilitate testing, more changes to user interface / options will be expected. The new mode is not enabled by default.
This commit is contained in:
164
mysql-test/suite/rpl/r/rpl_parallel_multilevel.result
Normal file
164
mysql-test/suite/rpl/r/rpl_parallel_multilevel.result
Normal file
@ -0,0 +1,164 @@
|
||||
include/rpl_init.inc [topology=1->2->3->4]
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional,waiting';
|
||||
*** MDEV-6676: Test that @@replicate_allow_parallel is preserved in slave binlog ***
|
||||
INSERT INTO t1 VALUES(1,1);
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES(2,1);
|
||||
INSERT INTO t1 VALUES(3,1);
|
||||
COMMIT;
|
||||
SET SESSION replicate_allow_parallel=0;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET SESSION replicate_allow_parallel=1;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 11
|
||||
3 1
|
||||
include/save_master_gtid.inc
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 11
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 11
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 11
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
*** MDEV-6676: Test that the FL_WAITED flag in GTID is preserved in slave binlog ***
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional';
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional';
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
SET GLOBAL slave_parallel_mode='domain,transactional';
|
||||
BEGIN;
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting1";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting1";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting2";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting2";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting3";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting3";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting4";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting4";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting5";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting5";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting6";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting6";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting7";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting7";
|
||||
SET debug_sync="thd_report_wait_for SIGNAL waiting8";
|
||||
UPDATE t1 SET b=b+1 WHERE a=2;
|
||||
SET debug_sync="now WAIT_FOR waiting8";
|
||||
COMMIT;
|
||||
SET debug_sync="RESET";
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
COMMIT;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 20
|
||||
3 1
|
||||
include/save_master_gtid.inc
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 20
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 20
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
include/start_slave.inc
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 1
|
||||
2 20
|
||||
3 1
|
||||
status
|
||||
Ok, no retry
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
include/start_slave.inc
|
||||
DROP TABLE t1;
|
||||
include/rpl_end.inc
|
Reference in New Issue
Block a user