[Commits] d943ed2: MDEV-7974 review/contribution:
revision-id: d943ed2c47839a4acfe501f5ee8129261dee3a70 (mariadb-10.4.3-80-gd943ed2) parent(s): 20b444ad535c058ce90d8195fbd2261cb6609dc4 committer: Andrei Elkin timestamp: 2019-04-03 20:39:25 +0300 message: MDEV-7974 review/contribution: gtid record of XA-prepare should no be merged into the replicated trx. This patch redirects it into the default mysql.gtid_slave_pos table. A test is added. --- mysql-test/suite/rpl/r/rpl_xa.result | 37 ++++-------- .../suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result | 65 ++++++++++++++++++++ mysql-test/suite/rpl/t/rpl_xa.inc | 69 ++++++++++++++++++++++ mysql-test/suite/rpl/t/rpl_xa.test | 43 +------------- .../suite/rpl/t/rpl_xa_gtid_pos_auto_engine.test | 25 ++++++++ 5 files changed, 171 insertions(+), 68 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_xa.result b/mysql-test/suite/rpl/r/rpl_xa.result index d406877..5d6dddb 100644 --- a/mysql-test/suite/rpl/r/rpl_xa.result +++ b/mysql-test/suite/rpl/r/rpl_xa.result @@ -1,31 +1,22 @@ include/master-slave.inc [connection master] +connection master; create table t1 (a int, b int) engine=InnoDB; xa start 't'; insert into t1 values(1, 2); xa end 't'; xa prepare 't'; xa commit 't'; -select * from t1; -a b -1 2 connection slave; -select * from t1; -a b -1 2 +include/diff_tables.inc [master:t1, slave:t1] connection master; xa start 't'; insert into t1 values(3, 4); xa end 't'; xa prepare 't'; xa rollback 't'; -select * from t1; -a b -1 2 connection slave; -select * from t1; -a b -1 2 +include/diff_tables.inc [master:t1, slave:t1] connection master; SET pseudo_slave_mode=1; create table t2 (a int) engine=InnoDB; @@ -37,26 +28,20 @@ xa start 's'; insert into t2 values (0); xa end 's'; xa prepare 's'; +include/sync_with_master_gtid.inc +xa recover; +formatID gtrid_length bqual_length data +1 1 0 t +1 1 0 s +connection master; xa commit 't'; xa commit 's'; SET pseudo_slave_mode=0; Warnings: Warning 1231 Slave applier execution mode not active, statement ineffective. -select * from t1; -a b -1 2 -5 6 -select * from t2; -a -0 connection slave; -select * from t1; -a b -1 2 -5 6 -select * from t2; -a -0 +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] connection master; drop table t1, t2; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result b/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result new file mode 100644 index 0000000..e8b4b05 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_xa_gtid_pos_auto_engine.result @@ -0,0 +1,65 @@ +include/master-slave.inc +[connection master] +connection slave; +call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase"); +include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; +SET @@global.gtid_pos_auto_engines="innodb"; +include/start_slave.inc +connection master; +create table t1 (a int, b int) engine=InnoDB; +insert into t1 values(0, 0); +xa start 't'; +insert into t1 values(1, 2); +xa end 't'; +xa prepare 't'; +xa commit 't'; +connection slave; +include/diff_tables.inc [master:t1, slave:t1] +connection master; +xa start 't'; +insert into t1 values(3, 4); +xa end 't'; +xa prepare 't'; +xa rollback 't'; +connection slave; +include/diff_tables.inc [master:t1, slave:t1] +connection master; +SET pseudo_slave_mode=1; +create table t2 (a int) engine=InnoDB; +xa start 't'; +insert into t1 values (5, 6); +xa end 't'; +xa prepare 't'; +xa start 's'; +insert into t2 values (0); +xa end 's'; +xa prepare 's'; +connection slave; +include/sync_with_master_gtid.inc +SELECT @@global.gtid_slave_pos = CONCAT(domain_id,"-",server_id,"-",seq_no) FROM mysql.gtid_slave_pos WHERE seq_no = (SELECT DISTINCT max(seq_no) FROM mysql.gtid_slave_pos); +@@global.gtid_slave_pos = CONCAT(domain_id,"-",server_id,"-",seq_no) +1 +xa recover; +formatID gtrid_length bqual_length data +1 1 0 t +1 1 0 s +connection master; +xa commit 't'; +xa commit 's'; +SET pseudo_slave_mode=0; +Warnings: +Warning 1231 Slave applier execution mode not active, statement ineffective. +connection slave; +include/diff_tables.inc [master:t1, slave:t1] +include/diff_tables.inc [master:t2, slave:t2] +connection master; +drop table t1, t2; +connection slave; +include/stop_slave.inc +SET @@global.gtid_pos_auto_engines=""; +SET @@session.sql_log_bin=0; +DROP TABLE mysql.gtid_slave_pos_InnoDB; +SET @@session.sql_log_bin=1; +include/start_slave.inc +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_xa.inc b/mysql-test/suite/rpl/t/rpl_xa.inc new file mode 100644 index 0000000..69d9f90 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa.inc @@ -0,0 +1,69 @@ +# +# This "body" file checks general properties of XA transaction replication +# as of MDEV-7974. +# Parameters: +# --let rpl_xa_check= SELECT ... +# +connection master; +create table t1 (a int, b int) engine=InnoDB; +insert into t1 values(0, 0); +xa start 't'; +insert into t1 values(1, 2); +xa end 't'; +xa prepare 't'; +xa commit 't'; + +sync_slave_with_master; +let $diff_tables= master:t1, slave:t1; +source include/diff_tables.inc; + +connection master; + +xa start 't'; +insert into t1 values(3, 4); +xa end 't'; +xa prepare 't'; +xa rollback 't'; + +sync_slave_with_master; +let $diff_tables= master:t1, slave:t1; +source include/diff_tables.inc; + +connection master; +SET pseudo_slave_mode=1; +create table t2 (a int) engine=InnoDB; +xa start 't'; +insert into t1 values (5, 6); +xa end 't'; +xa prepare 't'; +xa start 's'; +insert into t2 values (0); +xa end 's'; +xa prepare 's'; + +connection slave; +source include/sync_with_master_gtid.inc; +if ($rpl_xa_check) +{ + --eval $rpl_xa_check + if ($rpl_xa_verbose) + { + --eval SELECT $rpl_xa_check_lhs + --eval SELECT $rpl_xa_check_rhs + } +} +xa recover; + +connection master; +xa commit 't'; +xa commit 's'; +SET pseudo_slave_mode=0; + +sync_slave_with_master; +let $diff_tables= master:t1, slave:t1; +source include/diff_tables.inc; +let $diff_tables= master:t2, slave:t2; +source include/diff_tables.inc; + +connection master; +drop table t1, t2; diff --git a/mysql-test/suite/rpl/t/rpl_xa.test b/mysql-test/suite/rpl/t/rpl_xa.test index fda84b3..05a1abe 100644 --- a/mysql-test/suite/rpl/t/rpl_xa.test +++ b/mysql-test/suite/rpl/t/rpl_xa.test @@ -1,46 +1,5 @@ source include/have_innodb.inc; source include/master-slave.inc; -create table t1 (a int, b int) engine=InnoDB; -xa start 't'; -insert into t1 values(1, 2); -xa end 't'; -xa prepare 't'; -xa commit 't'; -select * from t1; -sync_slave_with_master; -select * from t1; -connection master; - -xa start 't'; -insert into t1 values(3, 4); -xa end 't'; -xa prepare 't'; -xa rollback 't'; -select * from t1; -sync_slave_with_master; -select * from t1; - -connection master; -SET pseudo_slave_mode=1; -create table t2 (a int) engine=InnoDB; -xa start 't'; -insert into t1 values (5, 6); -xa end 't'; -xa prepare 't'; -xa start 's'; -insert into t2 values (0); -xa end 's'; -xa prepare 's'; -xa commit 't'; -xa commit 's'; -SET pseudo_slave_mode=0; -select * from t1; -select * from t2; -sync_slave_with_master; -select * from t1; -select * from t2; - -connection master; -drop table t1, t2; +source rpl_xa.inc; source include/rpl_end.inc; diff --git a/mysql-test/suite/rpl/t/rpl_xa_gtid_pos_auto_engine.test b/mysql-test/suite/rpl/t/rpl_xa_gtid_pos_auto_engine.test new file mode 100644 index 0000000..803e29d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_xa_gtid_pos_auto_engine.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc +--source include/master-slave.inc + +--connection slave +call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase"); + +--source include/stop_slave.inc +CHANGE MASTER TO master_use_gtid=slave_pos; + +SET @@global.gtid_pos_auto_engines="innodb"; +--source include/start_slave.inc +--let $rpl_xa_check_lhs= @@global.gtid_slave_pos +--let $rpl_xa_check_rhs= CONCAT(domain_id,"-",server_id,"-",seq_no) FROM mysql.gtid_slave_pos WHERE seq_no = (SELECT DISTINCT max(seq_no) FROM mysql.gtid_slave_pos) +--let $rpl_xa_check=SELECT $rpl_xa_check_lhs = $rpl_xa_check_rhs +--source rpl_xa.inc + +--connection slave +--source include/stop_slave.inc +SET @@global.gtid_pos_auto_engines=""; +SET @@session.sql_log_bin=0; +DROP TABLE mysql.gtid_slave_pos_InnoDB; +SET @@session.sql_log_bin=1; +--source include/start_slave.inc + +--source include/rpl_end.inc
participants (1)
-
holyfoot@askmonty.org