polardbxengine/mysql-test/suite/xcluster/t/binlog_rds_rotate_xa_safe.test

477 lines
9.6 KiB
Plaintext

--source include/have_debug.inc
--source include/have_log_bin.inc
--source include/have_gtid.inc
--source include/have_debug_sync_new.inc
--source include/paxos.inc
connection default;
create table t1(id int);
--connect (con1,127.0.0.1,root,,test,$MYPORT_1)
--connect (con2,127.0.0.1,root,,test,$MYPORT_1)
--connect (con3,127.0.0.1,root,,test,$MYPORT_1)
--echo #
--echo # binlogged XA PREPARE block flush log
--echo #
connection con1;
xa begin '1101';
insert into t1 values (1101);
xa end '1101';
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send xa prepare '1101';
connection con2;
insert into t1 values (1102);
send flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
connection con2;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # binlogged XA Commit block flush log
--echo #
connection con1;
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send xa commit '1101';
connection con2;
insert into t1 values (1103);
send flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
connection con2;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # binlogged XA Commit ONE PHASE block flush log
--echo #
connection con1;
xa begin '1201';
insert into t1 values (1201);
xa end '1201';
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send xa commit "1201" one phase;
connection con2;
insert into t1 values (1202);
send flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
connection con2;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # binlogged XA Rollback block flush log
--echo #
connection con1;
xa begin '1301';
insert into t1 values (1301);
xa end '1301';
xa prepare '1301';
SET DEBUG_SYNC= 'after_binlog_rollback WAIT_FOR flush_log';
send xa rollback '1301';
connection con2;
insert into t1 values (1302);
send flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
connection con2;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # Normal trans commit will not block flush log
--echo #
connection con1;
begin;
insert into t1 values (1401);
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send commit;
connection con2;
insert into t1 values (1402);
flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # Normal trans rollback will not block flush log
--echo #
connection con1;
begin;
insert into t1 values (1501);
SET DEBUG_SYNC= 'after_binlog_rollback WAIT_FOR flush_log';
send commit;
connection con2;
flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # xa prepare without binlogged will not block flush log
--echo #
connection con1;
xa begin '1601';
xa end '1601';
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send xa prepare '1601';
connection con2;
insert into t1 values (1602);
flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # xa commit without binlogged will not block flush log
--echo #
connection con1;
SET DEBUG_SYNC= 'after_binlog_commit WAIT_FOR flush_log';
send xa commit '1601';
connection con2;
insert into t1 values (1603);
flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # xa rollback without binlogged will not block flush log
--echo #
connection con1;
xa begin '1701';
xa end '1701';
xa prepare '1701';
SET DEBUG_SYNC= 'after_binlog_rollback WAIT_FOR flush_log';
send xa rollback '1701';
connection con2;
insert into t1 values (1701);
flush logs;
connection con3;
SET DEBUG_SYNC= 'now signal flush_log';
connection con1;
reap;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
drop table t1;
--echo #
--echo # XA will not block itself when flush log due to binlog size
--echo #
create table t1 (a int,b varchar(8000));
SET GLOBAL max_binlog_size = 4096;
--echo #
--echo # XA PREPARE binlogged will delay and do binlog rotation
--echo #
XA START "1801";
INSERT INTO t1 VALUES(1, repeat('a', 4096));
XA END "1801";
XA PREPARE "1801";
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # XA COMMIT binlogged will delay and do binlog rotation
--echo #
connection con1;
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL leader_in_flush_stage
WAIT_FOR leader_continue";
send XA COMMIT "1801";
connection con2;
SET debug_sync = "now WAIT_FOR leader_in_flush_stage";
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL con1_in_flush_stage
WAIT_FOR con1_continue";
send INSERT INTO t1 VALUES(1, repeat('a', 4096));
connection con3;
SET debug_sync = "now WAIT_FOR con1_in_flush_stage";
SET debug_sync = "now SIGNAL leader_continue";
SET debug_sync = "now SIGNAL con1_continue";
--connection con1
--reap
--connection con2
--reap
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # xa rollback binlogged will delay and do binlog rotation
--echo #
connection con1;
XA START "1901";
INSERT INTO t1 VALUES(1, repeat('a', 4096));
XA END "1901";
XA PREPARE "1901";
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL leader_in_flush_stage
WAIT_FOR leader_continue";
send XA ROLLBACK "1901";
connection con2;
SET debug_sync = "now WAIT_FOR leader_in_flush_stage";
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL con1_in_flush_stage
WAIT_FOR con1_continue";
send INSERT INTO t1 VALUES(1,repeat('a', 4096));
connection con3;
SET debug_sync = "now WAIT_FOR con1_in_flush_stage";
SET debug_sync = "now SIGNAL leader_continue";
SET debug_sync = "now SIGNAL con1_continue";
--connection con1
--reap
--connection con2
--reap
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # Leader can rotate correctly if XA is in the flush group
--echo #
connection con1;
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL leader_in_flush_stage
WAIT_FOR leader_continue";
send INSERT INTO t1 VALUES(1, repeat('a', 4096));
connection con2;
XA START "2001";
INSERT INTO t1 VALUES(1, "a");
XA END "2001";
SET debug_sync = "now WAIT_FOR leader_in_flush_stage";
SET debug_sync =
"bgc_after_enrolling_for_flush_stage SIGNAL con1_in_flush_stage
WAIT_FOR con1_continue";
send XA PREPARE "2001";
connection con3;
SET debug_sync = "now WAIT_FOR con1_in_flush_stage";
SET debug_sync = "now SIGNAL leader_continue";
SET debug_sync = "now SIGNAL con1_continue";
connection con1;
--reap
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
connection con2;
--reap
XA COMMIT "2001";
--echo #
--echo # XA COMMIT ONE PHASE binlogged will delay and do binlog rotation
--echo #
connection con1;
XA START "2101";
INSERT INTO t1 VALUES(1, repeat('a', 4096));
XA END "2101";
XA COMMIT "2101" ONE PHASE;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3,5
--source include/show_binlog_events.inc
--echo #
--echo # Rotation Error on XA PREPARE no abort
--echo #
flush logs;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3, 50
connection con1;
SET debug = "d,fault_injection_new_file_rotate_event";
SET GLOBAL binlog_error_action = IGNORE_ERROR;
XA START "2201";
INSERT INTO t1 VALUES(1, repeat('a', 4096));
XA END "2201";
XA PREPARE "2201";
--connection default
--let $restart_parameters = restart: --skip-core-file
--source include/restart_mysqld.inc
--let $assert_text = Find Log: Turning logging off for the whole duration
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_select = Turning logging off for the whole duration
--let $assert_count = 1
--source include/assert_grep.inc
XA COMMIT "2201";
--source include/show_binlog_events.inc
--echo #
--echo # Rotation Error on XA PREPARE and Abort server
--echo #
flush logs;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_limit= 3, 50
SET GLOBAL max_binlog_size = 4096;
SET debug = "d,fault_injection_new_file_rotate_event";
XA START "2301";
INSERT INTO t1 VALUES(1, repeat('a', 4096));
XA END "2301";
--source include/expect_crash.inc
--error 1598 #
XA PREPARE "2301";
--source include/start_mysqld.inc
SET GLOBAL max_binlog_size = 4096;
XA RECOVER;
XA COMMIT "2301";
--source include/show_binlog_events.inc
connection default;
--disconnect con1
--disconnect con2
--disconnect con3
drop table t1;