| 1 |
RESET MASTER; |
| 2 |
# |
| 3 |
# 1. Save current binlog file name |
| 4 |
include/save_binlog_position.inc |
| 5 |
# |
| 6 |
# 2. Generate new binlogs |
| 7 |
FLUSH BINARY LOGS; |
| 8 |
FLUSH BINARY LOGS; |
| 9 |
# |
| 10 |
# 3. Case1: Purge binlogs using 'PURGE BINARY LOGS TO' |
| 11 |
# |
| 12 |
# 3.1 Lock instance for backup |
| 13 |
LOCK INSTANCE FOR BACKUP; |
| 14 |
# |
| 15 |
# 3.2 Purge binlogs |
| 16 |
include/save_binlog_position.inc |
| 17 |
FLUSH BINARY LOGS; |
| 18 |
PURGE BINARY LOGS TO 'BINLOG_FILE'; |
| 19 |
ERROR HY000: Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock. |
| 20 |
# |
| 21 |
# 3.3 Verify that binlogs are not purged |
| 22 |
include/assert.inc [Expected binary log file] |
| 23 |
# |
| 24 |
# 3.4 Unlock instance for backup |
| 25 |
UNLOCK INSTANCE; |
| 26 |
# |
| 27 |
# 4. Case2: Purge binlogs using 'PURGE BINARY LOGS BEFORE' |
| 28 |
# |
| 29 |
# 4.1 Lock instance for backup |
| 30 |
LOCK INSTANCE FOR BACKUP; |
| 31 |
# |
| 32 |
# 4.2 Purge binlogs |
| 33 |
FLUSH BINARY LOGS; |
| 34 |
ERROR HY000: Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock. |
| 35 |
# |
| 36 |
# 4.3 Verify that binlogs are not purged |
| 37 |
include/assert.inc [Expected binary log file] |
| 38 |
# |
| 39 |
# 4.4 Unlock instance |
| 40 |
UNLOCK INSTANCE; |