| 1 |
# === Purpose === |
| 2 |
# Check PURGE BINARY LOGS operation is mutually exclusive with BACKUP lock. |
| 3 |
# |
| 4 |
# === Requirements === |
| 5 |
# R1. PURGE BINARY LOGS must be mutually exclusive with BACKUP operation. |
| 6 |
# |
| 7 |
# === Implementation === |
| 8 |
# 1. Lock replica for backup |
| 9 |
# 2. Flush binary logs so relay log is tried to be pureged |
| 10 |
# 3. Check that relay logs have not been purged |
| 11 |
# 4. Unblock backup on replica |
| 12 |
# 5. Generate log purge from source onto replica |
| 13 |
# 6. Check relay logs have been purged on replica |
| 14 |
# |
| 15 |
# === References === |
| 16 |
# Bug#35342521 Binary log purge should hold IX backup lock |
| 17 |
# |
| 18 |
--source include/have_debug.inc |
| 19 |
--source include/have_debug_sync.inc |
| 20 |
--source include/have_binlog_format_row.inc |
| 21 |
--source include/master-slave.inc |
| 22 |
|
| 23 |
--echo # |
| 24 |
--echo # Lock replica for backup |
| 25 |
--echo # |
| 26 |
|
| 27 |
--source include/rpl_connection_slave.inc |
| 28 |
--let $MYSQLD_SLAVE_DATADIR = `select @@datadir` |
| 29 |
--source include/save_error_log_position.inc |
| 30 |
LOCK INSTANCE FOR BACKUP; |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Flush binary logs so relay log is tried to be purged |
| 34 |
--echo # |
| 35 |
|
| 36 |
--source include/rpl_connection_master.inc |
| 37 |
FLUSH BINARY LOGS; |
| 38 |
|
| 39 |
--echo # |
| 40 |
--echo # Check that relay logs have not been purged on replica |
| 41 |
--echo # |
| 42 |
|
| 43 |
--source include/sync_slave_sql_with_master.inc |
| 44 |
|
| 45 |
--replace_regex /[\\]/\// |
| 46 |
--cat_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index |
| 47 |
|
| 48 |
let $error_pattern = |
| 49 |
Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock. |
| 50 |
Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock.; |
| 51 |
--source include/assert_error_log.inc |
| 52 |
|
| 53 |
--echo # |
| 54 |
--echo # Unblock backup on replica |
| 55 |
--echo # |
| 56 |
|
| 57 |
--source include/save_error_log_position.inc |
| 58 |
UNLOCK INSTANCE; |
| 59 |
|
| 60 |
--echo # |
| 61 |
--echo # Generate log purge from source onto replica |
| 62 |
--echo # |
| 63 |
|
| 64 |
--source include/rpl_connection_master.inc |
| 65 |
FLUSH BINARY LOGS; |
| 66 |
|
| 67 |
--echo # |
| 68 |
--echo # Check relay logs have been purged on replica |
| 69 |
--echo # |
| 70 |
|
| 71 |
--source include/sync_slave_sql_with_master.inc |
| 72 |
|
| 73 |
--replace_regex /[\\]/\// |
| 74 |
--cat_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index |
| 75 |
|
| 76 |
--let $error_pattern = NONE |
| 77 |
--source include/assert_error_log.inc |
| 78 |
|
| 79 |
call mtr.add_suppression("Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock."); |
| 80 |
|
| 81 |
--echo # |
| 82 |
--echo # Cleanup |
| 83 |
--echo # |
| 84 |
|
| 85 |
--source include/rpl_connection_master.inc |
| 86 |
--source include/rpl_end.inc |
| 87 |
|