@@ -85,7 +85,7 @@ DROP TABLE t2;
85
85
86
86
#
87
87
# MDEV-32611 Added test for mysqldump --delete-master-logs option.
88
- # This options is alias of
88
+ # This options is alias of
89
89
# get binlogs: show master status -> flush logs -> purge binary logs to <new_binlog>
90
90
# sequence and this test is derived using the same pattern.
91
91
#
@@ -101,6 +101,33 @@ insert into t values (2);
101
101
102
102
drop table t;
103
103
104
+ --sync_slave_with_master
105
+
106
+ # MDEV-32953: Because --delete-master-logs immediately purges logs after
107
+ # flushing, it is possible the binlog dump threads will still be using the old
108
+ # log when the purge executes, disallowing the file from being deleted.
109
+ # Therefore, we temporarily stop the slave so there is no chance the old binlog
110
+ # is still being referenced. master_use_gtid=Slave_pos is necessary to still
111
+ # appear up-to-date to the master on restart after the master has flushed the
112
+ # logs (while the slave is offline). Otherwise (i.e. if using binlog file/pos),
113
+ # the slave would point to a purged log file, and receive an error immediately
114
+ # upon connecting to the master.
115
+ --source include/stop_slave.inc
116
+ change master to master_use_gtid=slave_pos;
117
+
118
+ connection master;
119
+
120
+ --echo # Ensuring the binlog dump thread is killed on primary...
121
+ --disable_query_log
122
+ --let $binlog_dump_thd_tid= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND LIKE 'Binlog Dump'`
123
+ if ($binlog_dump_thd_tid)
124
+ {
125
+ --eval kill $binlog_dump_thd_tid
126
+ }
127
+ --let $wait_condition= SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND LIKE 'Binlog Dump'
128
+ --source include/wait_condition.inc
129
+ --enable_query_log
130
+
104
131
--let $predump_binlog_filename= query_get_value(SHOW MASTER STATUS, File, 1)
105
132
106
133
# Execute mysqldump with delete-master-logs option
@@ -125,4 +152,7 @@ if ($postdump_first_binary_log_filename != $postdump_binlog_filename)
125
152
--die Master binlog wasn't deleted after mariadb-dump with --delete-master-logs.
126
153
}
127
154
155
+ connection slave;
156
+ --source include/start_slave.inc
157
+
128
158
--source include/rpl_end.inc
0 commit comments