| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection master; |
| 4 |
call mtr.add_suppression("Got an error writing communication packets"); |
| 5 |
call mtr.add_suppression("Got an error reading communication packets"); |
| 6 |
call mtr.add_suppression("Could not read packet:.* vio_errno: 1158"); |
| 7 |
call mtr.add_suppression("Could not write packet:.* vio_errno: 1160"); |
| 8 |
set @save_semi_sync_master_enabled= @@global.rpl_semi_sync_master_enabled; |
| 9 |
set @save_semi_sync_wp= @@global.rpl_semi_sync_master_wait_point; |
| 10 |
set @save_bgc_count= @@global.binlog_commit_wait_count; |
| 11 |
set @save_bgc_usec= @@global.binlog_commit_wait_usec; |
| 12 |
set @old_master_wait_point= @@global.rpl_semi_sync_master_wait_point; |
| 13 |
set @old_master_wait_no_slave= @@global.rpl_semi_sync_master_wait_no_slave; |
| 14 |
set @save_debug_dbug= @@global.debug_dbug; |
| 15 |
set @@global.binlog_commit_wait_count=3; |
| 16 |
set @@global.binlog_commit_wait_usec=10000000; |
| 17 |
set @@global.debug_dbug="+d,testing_cond_var_per_thd"; |
| 18 |
set @@global.rpl_semi_sync_master_enabled= 1; |
| 19 |
set @@global.rpl_semi_sync_master_wait_point= AFTER_COMMIT; |
| 20 |
# Ensure semi-sync is on |
| 21 |
connection slave; |
| 22 |
set @save_semi_sync_slave_enabled= @@global.rpl_semi_sync_master_enabled; |
| 23 |
include/stop_slave.inc |
| 24 |
set @@global.rpl_semi_sync_slave_enabled=1; |
| 25 |
include/start_slave.inc |
| 26 |
connection master; |
| 27 |
# Create three transactions to binlog group commit together |
| 28 |
connection master; |
| 29 |
create table t1 (a int); |
| 30 |
connection server_1; |
| 31 |
create table t2 (a int); |
| 32 |
connection default; |
| 33 |
create table t3 (a int); |
| 34 |
connection master; |
| 35 |
connection server_1; |
| 36 |
connection default; |
| 37 |
include/assert_grep.inc [Check that there is no 'Thread awaiting semi-sync ACK was awoken before its ACK' warning in error log.] |
| 38 |
connection slave; |
| 39 |
# |
| 40 |
# Cleanup |
| 41 |
connection master; |
| 42 |
set @@global.binlog_commit_wait_count=@save_bgc_count; |
| 43 |
set @@global.binlog_commit_wait_usec=@save_bgc_usec; |
| 44 |
set @@global.debug_dbug=@save_debug_dbug; |
| 45 |
drop table t1, t2, t3; |
| 46 |
connection slave; |
| 47 |
# |
| 48 |
# MDEV-34122 |
| 49 |
# If semi-sync is switched off then on while a transaction is |
| 50 |
# in-between binlogging and waiting for an ACK, ensure that the |
| 51 |
# transaction skips the wait altogether (otherwise it would time-out). |
| 52 |
# Note that prior to MDEV-34122, there was a debug assertion that would |
| 53 |
# trigger if the transaction tried to wait but could not receive an ACK |
| 54 |
# signal. |
| 55 |
# |
| 56 |
# MDEV-34122.a: Test wait_point = AFTER_SYNC |
| 57 |
# Here, debug_sync is used to pause the leader thread between reporting |
| 58 |
# the binlogging to semi-sync, and starting the wait for ACK; and during |
| 59 |
# this pause, semi-sync is manually switched off and on. |
| 60 |
connection master; |
| 61 |
set @@global.rpl_semi_sync_master_wait_point= AFTER_SYNC; |
| 62 |
set @@global.rpl_semi_sync_master_wait_no_slave= 1; |
| 63 |
set @@global.debug_dbug="+d,semisync_log_skip_trx_wait"; |
| 64 |
# Waiting for semi-sync to turn on.. |
| 65 |
connection slave; |
| 66 |
connection master; |
| 67 |
create table t (a int) engine=innodb; |
| 68 |
connection slave; |
| 69 |
# Wait no slave is on, so we don't need to slave on to wait for the |
| 70 |
# ACK, and this way we guarantee the ACK doesn't come, so we can verify |
| 71 |
# the informational message is displayed |
| 72 |
connection slave; |
| 73 |
include/stop_slave.inc |
| 74 |
connection master; |
| 75 |
include/kill_binlog_dump_threads.inc |
| 76 |
connection server_1; |
| 77 |
start transaction; |
| 78 |
insert into t values (0); |
| 79 |
set debug_sync= "commit_after_release_LOCK_log SIGNAL trx_binlogged WAIT_FOR continue_commit"; |
| 80 |
commit; |
| 81 |
connection master; |
| 82 |
set debug_sync= "now WAIT_FOR trx_binlogged"; |
| 83 |
# Switching semi-sync off/on |
| 84 |
set @@global.rpl_semi_sync_master_enabled= 0; |
| 85 |
set @@global.rpl_semi_sync_master_enabled= 1; |
| 86 |
# Resuming transaction to await ACK |
| 87 |
set debug_sync= "now SIGNAL continue_commit"; |
| 88 |
connection server_1; |
| 89 |
include/assert_grep.inc [Ensure error log shows that transaction is skipping its semi-sync wait] |
| 90 |
# Cleanup |
| 91 |
connection slave; |
| 92 |
include/start_slave.inc |
| 93 |
connection master; |
| 94 |
drop table t; |
| 95 |
connection slave; |
| 96 |
# |
| 97 |
# MDEV-34122.b: Test wait_point = AFTER_COMMIT |
| 98 |
# Here, use a transaction with a non-transactional statement to write to |
| 99 |
# the binlog directly, and turn off/on semi-sync before committing the |
| 100 |
# transaction. |
| 101 |
connection master; |
| 102 |
set @@global.rpl_semi_sync_master_wait_point= AFTER_COMMIT; |
| 103 |
# Waiting for semi-sync to turn on.. |
| 104 |
connection slave; |
| 105 |
connection master; |
| 106 |
create table tn (a int) engine=Aria; |
| 107 |
start transaction; |
| 108 |
insert into tn values (NULL); |
| 109 |
set @@global.rpl_semi_sync_master_enabled= 0; |
| 110 |
set @@global.rpl_semi_sync_master_enabled= 1; |
| 111 |
commit; |
| 112 |
# Cleanup |
| 113 |
connection master; |
| 114 |
drop table tn; |
| 115 |
set @@global.debug_dbug=@save_debug_dbug; |
| 116 |
# |
| 117 |
# MDEV-36934 |
| 118 |
# The server could indefinitely hang due to a memory leak which tried to |
| 119 |
# pthread signal on a destroyed condition variable. In effect, no |
| 120 |
# connections could commit transactions because there would be a thread |
| 121 |
# stuck on a never-returning call to pthread_cond_signal() while |
| 122 |
# holding Repl_semi_sync_master::LOCK_log. |
| 123 |
connection master; |
| 124 |
set @@global.rpl_semi_sync_master_wait_point= AFTER_COMMIT; |
| 125 |
set @@global.rpl_semi_sync_master_wait_no_slave= 0; |
| 126 |
# Ensure servers are in proper state |
| 127 |
connection master; |
| 128 |
connection slave; |
| 129 |
# Test case initial set-up |
| 130 |
connection master; |
| 131 |
create table t_36934 (a int) engine=innodb; |
| 132 |
include/save_master_gtid.inc |
| 133 |
connection slave; |
| 134 |
include/sync_with_master_gtid.inc |
| 135 |
# Pause the user transaction before inserting into Active_tranx |
| 136 |
connect user_con,localhost,root,,; |
| 137 |
SET debug_sync= 'semisync_at_write_tranx_in_binlog SIGNAL at_write_tranx_in_binlog WAIT_FOR resume_write_tranx_in_binlog'; |
| 138 |
insert into t_36934 values (1); |
| 139 |
connection server_1; |
| 140 |
set debug_sync="now wait_for at_write_tranx_in_binlog"; |
| 141 |
# Disconnect the slave (note that the binlog dump thread won't yet be |
| 142 |
# notified of a binlog update from the last transaction, so the slave |
| 143 |
# should neither receiver nor ACK the transaction). |
| 144 |
connection slave; |
| 145 |
include/stop_slave.inc |
| 146 |
# Waiting for master to realize the slave has disconnected.. |
| 147 |
connection server_1; |
| 148 |
# ..done |
| 149 |
# Resuming transaction (it will exit commit_trx early without waiting) |
| 150 |
set debug_sync="now signal resume_write_tranx_in_binlog"; |
| 151 |
connection user_con; |
| 152 |
disconnect user_con; |
| 153 |
# Force delete the user thread (FLUSH THREADS ensures the thread won't |
| 154 |
# stay in the thread cache) |
| 155 |
connection master; |
| 156 |
FLUSH THREADS; |
| 157 |
# BUG: Re-connect slave. MDEV-36934 reports that the master would hang |
| 158 |
# when the slave would re-connect and try to ACK the last transaction |
| 159 |
# who's thread has been deleted |
| 160 |
connection slave; |
| 161 |
include/start_slave.inc |
| 162 |
# Try to commit another transaction (prior to MDEV-36934 fixes, this |
| 163 |
# would hang indefinitely) |
| 164 |
connection master; |
| 165 |
set debug_sync="RESET"; |
| 166 |
insert into t_36934 values (2); |
| 167 |
connection server_1; |
| 168 |
# Waiting 30s for last query to complete.. |
| 169 |
connection master; |
| 170 |
# ..done |
| 171 |
# Cleanup |
| 172 |
connection master; |
| 173 |
set @@global.rpl_semi_sync_master_wait_point= @old_master_wait_point; |
| 174 |
set @@global.rpl_semi_sync_master_wait_no_slave= @old_master_wait_no_slave; |
| 175 |
set @@global.debug_dbug=@save_debug_dbug; |
| 176 |
set @@global.rpl_semi_sync_master_enabled= @save_semi_sync_master_enabled; |
| 177 |
set @@global.rpl_semi_sync_master_wait_point= @save_semi_sync_wp; |
| 178 |
drop table t_36934; |
| 179 |
connection slave; |
| 180 |
include/stop_slave.inc |
| 181 |
set @@global.rpl_semi_sync_slave_enabled= @save_semi_sync_slave_enabled; |
| 182 |
include/start_slave.inc |
| 183 |
include/rpl_end.inc |