Commit 7de0c7b5 authored by Brandon Nesterenko's avatar Brandon Nesterenko

MDEV-31038: rpl.rpl_xa_prepare_gtid_fail clean up

- Removed commented out and unused lines.
- Updated test to reference true failure of timeout
  rather than deadlock
- Switched save variables from MTR to user
- Forced relay-log purge to not potentially re-execute
  an already prepared transaction
parent 9e9cefde
...@@ -2,14 +2,14 @@ include/master-slave.inc ...@@ -2,14 +2,14 @@ include/master-slave.inc
[connection master] [connection master]
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
set @save_par_thds= @@global.slave_parallel_threads;
set @save_strict_mode= @@global.gtid_strict_mode;
set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos; change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4; set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic; set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON; set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0; set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
create table t1 (a int primary key, b int) engine=innodb; create table t1 (a int primary key, b int) engine=innodb;
...@@ -27,25 +27,25 @@ xa end '1'; ...@@ -27,25 +27,25 @@ xa end '1';
xa prepare '1'; xa prepare '1';
xa commit '1'; xa commit '1';
include/save_master_gtid.inc include/save_master_gtid.inc
connection slave;
connection slave1; connection slave1;
BEGIN; BEGIN;
SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE; SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=100 FOR UPDATE;
domain_id sub_id server_id seq_no domain_id sub_id server_id seq_no
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc
include/wait_for_slave_sql_error.inc [errno=1942,1213] include/wait_for_slave_sql_error.inc [errno=1942]
include/stop_slave_io.inc
connection slave1; connection slave1;
ROLLBACK; ROLLBACK;
# Cleanup # Cleanup
connection master; connection master;
drop table t1; drop table t1;
connection slave; connection slave;
include/stop_slave.inc # TODO: Remove after fixing MDEV-21777
set @@global.gtid_slave_pos= "0-1-100"; set @@global.gtid_slave_pos= "0-1-100";
set @@global.slave_parallel_threads= 0; set @@global.slave_parallel_threads= @save_par_thds;
set @@global.gtid_strict_mode= 0; set @@global.gtid_strict_mode= @save_strict_mode;
set @@global.innodb_lock_wait_timeout= 50; set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
include/start_slave.inc include/start_slave.inc
include/rpl_end.inc include/rpl_end.inc
# End of rpl_xa_prepare_gtid_fail.test # End of rpl_xa_prepare_gtid_fail.test
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
# GTID slave state, then the slave should immediately quit in error, without # GTID slave state, then the slave should immediately quit in error, without
# retry. # retry.
# #
# This tests validates the above behavior by simulating a deadlock on the # This tests validates the above behavior by forcing a lock-wait timeout on
# GTID slave state table during the second part of XA PREPARE's commit, to # the GTID slave state table during the second part of XA PREPARE's commit, to
# ensure that the appropriate error is reported and the transaction was never # ensure that the appropriate error is reported and the transaction was never
# retried. # retried.
# #
...@@ -23,23 +23,19 @@ source include/have_innodb.inc; ...@@ -23,23 +23,19 @@ source include/have_innodb.inc;
--connection slave --connection slave
--source include/stop_slave.inc --source include/stop_slave.inc
--let $save_par_thds= `SELECT @@global.slave_parallel_threads` set @save_par_thds= @@global.slave_parallel_threads;
--let $save_strict_mode= `SELECT @@global.gtid_strict_mode` set @save_strict_mode= @@global.gtid_strict_mode;
--let $save_innodb_lock_wait_timeout= `SELECT @@global.innodb_lock_wait_timeout` set @save_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
change master to master_use_gtid=slave_pos; change master to master_use_gtid=slave_pos;
set @@global.slave_parallel_threads= 4; set @@global.slave_parallel_threads= 4;
set @@global.slave_parallel_mode= optimistic; set @@global.slave_parallel_mode= optimistic;
set @@global.gtid_strict_mode=ON; set @@global.gtid_strict_mode=ON;
set sql_log_bin= 0; set statement sql_log_bin=0 for alter table mysql.gtid_slave_pos engine=innodb;
alter table mysql.gtid_slave_pos engine=innodb;
call mtr.add_suppression("Deadlock found.*");
set sql_log_bin= 1;
--source include/start_slave.inc --source include/start_slave.inc
--connection master --connection master
let $datadir= `select @@datadir`;
create table t1 (a int primary key, b int) engine=innodb; create table t1 (a int primary key, b int) engine=innodb;
insert t1 values (1,1); insert t1 values (1,1);
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
...@@ -64,11 +60,6 @@ xa prepare '1'; ...@@ -64,11 +60,6 @@ xa prepare '1';
xa commit '1'; xa commit '1';
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--connection slave
#--eval set statement sql_log_bin=0 for insert into mysql.gtid_slave_pos values ($gtid_domain_id, 5, $gtid_server_id, $xap_seq_no)
--connection slave1 --connection slave1
BEGIN; BEGIN;
--eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE --eval SELECT * FROM mysql.gtid_slave_pos WHERE seq_no=$xap_seq_no FOR UPDATE
...@@ -76,9 +67,14 @@ BEGIN; ...@@ -76,9 +67,14 @@ BEGIN;
--connection slave --connection slave
--source include/start_slave.inc --source include/start_slave.inc
--let $slave_sql_errno= 1942,1213 --let $slave_sql_errno= 1942
--source include/wait_for_slave_sql_error.inc --source include/wait_for_slave_sql_error.inc
# TODO: Remove after fixing MDEV-21777
# Stop the IO thread too, so the existing relay logs are force purged on slave
# restart, as to not re-execute the already-prepared transaction
--source include/stop_slave_io.inc
--let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1) --let $retried_tx_test= query_get_value(SHOW ALL SLAVES STATUS, Retried_transactions, 1)
if ($retried_tx_initial != $retried_tx_test) if ($retried_tx_initial != $retried_tx_test)
{ {
...@@ -95,11 +91,11 @@ ROLLBACK; ...@@ -95,11 +91,11 @@ ROLLBACK;
drop table t1; drop table t1;
--connection slave --connection slave
--source include/stop_slave.inc --echo # TODO: Remove after fixing MDEV-21777
--eval set @@global.gtid_slave_pos= "$new_gtid" --eval set @@global.gtid_slave_pos= "$new_gtid"
--eval set @@global.slave_parallel_threads= $save_par_thds set @@global.slave_parallel_threads= @save_par_thds;
--eval set @@global.gtid_strict_mode= $save_strict_mode set @@global.gtid_strict_mode= @save_strict_mode;
--eval set @@global.innodb_lock_wait_timeout= $save_innodb_lock_wait_timeout set @@global.innodb_lock_wait_timeout= @save_innodb_lock_wait_timeout;
--source include/start_slave.inc --source include/start_slave.inc
--source include/rpl_end.inc --source include/rpl_end.inc
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment