1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
include/master-slave.inc
[connection master]
connection master;
call mtr.add_suppression("Got an error writing communication packets");
call mtr.add_suppression("Got an error reading communication packets");
call mtr.add_suppression("Could not read packet:.* vio_errno: 1158");
call mtr.add_suppression("Could not write packet:.* vio_errno: 1160");
set @save_semi_sync_master_enabled= @@global.rpl_semi_sync_master_enabled;
set @save_semi_sync_wp= @@global.rpl_semi_sync_master_wait_point;
set @save_bgc_count= @@global.binlog_commit_wait_count;
set @save_bgc_usec= @@global.binlog_commit_wait_usec;
set @save_debug_dbug= @@global.debug_dbug;
set @@global.binlog_commit_wait_count=3;
set @@global.binlog_commit_wait_usec=10000000;
set @@global.debug_dbug="+d,testing_cond_var_per_thd";
set @@global.rpl_semi_sync_master_enabled= 1;
set @@global.rpl_semi_sync_master_wait_point= AFTER_COMMIT;
# Ensure semi-sync is on
connection slave;
set @save_semi_sync_slave_enabled= @@global.rpl_semi_sync_master_enabled;
include/stop_slave.inc
set @@global.rpl_semi_sync_slave_enabled=1;
include/start_slave.inc
connection master;
# Create three transactions to binlog group commit together
connection master;
create table t1 (a int);
connection server_1;
create table t2 (a int);
connection default;
create table t3 (a int);
connection master;
connection server_1;
connection default;
include/assert_grep.inc [Check that there is no 'Thread awaiting semi-sync ACK was awoken before its ACK' warning in error log.]
connection slave;
#
# Cleanup
connection master;
set @@global.binlog_commit_wait_count=@save_bgc_count;
set @@global.binlog_commit_wait_usec=@save_bgc_usec;
set @@global.debug_dbug=@save_debug_dbug;
drop table t1, t2, t3;
connection slave;
#
# MDEV-34122
# If semi-sync is switched off then on while a transaction is
# in-between binlogging and waiting for an ACK, ensure that the
# transaction skips the wait altogether (otherwise it would time-out).
# Note that prior to MDEV-34122, there was a debug assertion that would
# trigger if the transaction tried to wait but could not receive an ACK
# signal.
#
# MDEV-34122.a: Test wait_point = AFTER_SYNC
# Here, debug_sync is used to pause the leader thread between reporting
# the binlogging to semi-sync, and starting the wait for ACK; and during
# this pause, semi-sync is manually switched off and on.
connection master;
set @old_master_wait_point= @@global.rpl_semi_sync_master_wait_point;
set @old_master_wait_no_slave= @@global.rpl_semi_sync_master_wait_no_slave;
set @@global.rpl_semi_sync_master_wait_point= AFTER_SYNC;
set @@global.rpl_semi_sync_master_wait_no_slave= 1;
set @@global.debug_dbug="+d,semisync_log_skip_trx_wait";
# Waiting for semi-sync to turn on..
connection slave;
connection master;
create table t (a int) engine=innodb;
connection slave;
# Wait no slave is on, so we don't need to slave on to wait for the
# ACK, and this way we guarantee the ACK doesn't come, so we can verify
# the informational message is displayed
connection slave;
include/stop_slave.inc
connection master;
include/kill_binlog_dump_threads.inc
connection server_1;
start transaction;
insert into t values (0);
set debug_sync= "commit_after_release_LOCK_log SIGNAL trx_binlogged WAIT_FOR continue_commit";
commit;
connection master;
set debug_sync= "now WAIT_FOR trx_binlogged";
# Switching semi-sync off/on
set @@global.rpl_semi_sync_master_enabled= 0;
set @@global.rpl_semi_sync_master_enabled= 1;
# Resuming transaction to await ACK
set debug_sync= "now SIGNAL continue_commit";
connection server_1;
include/assert_grep.inc [Ensure error log shows that transaction is skipping its semi-sync wait]
# Cleanup
connection slave;
include/start_slave.inc
connection master;
drop table t;
connection slave;
#
# MDEV-34122.b: Test wait_point = AFTER_COMMIT
# Here, use a transaction with a non-transactional statement to write to
# the binlog directly, and turn off/on semi-sync before committing the
# transaction.
connection master;
set @@global.rpl_semi_sync_master_wait_point= AFTER_COMMIT;
# Waiting for semi-sync to turn on..
connection slave;
connection master;
create table tn (a int) engine=Aria;
start transaction;
insert into tn values (NULL);
set @@global.rpl_semi_sync_master_enabled= 0;
set @@global.rpl_semi_sync_master_enabled= 1;
commit;
# Cleanup
connection master;
drop table tn;
set @@global.rpl_semi_sync_master_wait_point= @old_master_wait_point;
set @@global.rpl_semi_sync_master_wait_no_slave= @old_master_wait_no_slave;
set @@global.debug_dbug=@save_debug_dbug;
set @@global.rpl_semi_sync_master_enabled= @save_semi_sync_master_enabled;
set @@global.rpl_semi_sync_master_wait_point= @save_semi_sync_wp;
connection slave;
include/stop_slave.inc
set @@global.rpl_semi_sync_slave_enabled= @save_semi_sync_slave_enabled;
include/start_slave.inc
include/rpl_end.inc
|