Bug #18453 Warning/error message if there is a mismatch between binary logs and index file
Submitted: 23 Mar 2006 11:23 Modified: 5 Apr 2008 16:24
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:4.1 OS:Microsoft Windows (windows)
Assigned to: Andrei Elkin
Triage: D3 (Medium) / R2 (Low) / E2 (Low)

[23 Mar 2006 11:23] Victoria Reznichenko
If there is mismatch between existing binary logs on disk and index file, PURGE LOGS doesn't provide any error message.
Now it reports:
mysql> purge binary logs before '2006-03-23';
Query OK, 0 rows affected (0.02 sec)

but doesn't really remove any binary log file.

How to repeat:
1. start MySQL server with --log-bin option
2. Do FLUSH LOGS several times (to generate several binary logs)
3. remove manually first generated binary log file.
Now this file is listed in the .index file but doesn't exist on disk anymore.
4. Do PURGE LOGS that way so it should remove deleted log file as well.
5. Check if files were removed.

The same happens if you remove lines from index file though binary logs still exist.

Suggested fix:
Provide warning or error message.
[15 May 2006 17:01] Jon Wagoner
I've experienced the same thing, and noticed this is a duplicate of bug 18199.
[8 Mar 2008 11:36] Andrei Elkin
Bug #18199 must be the parent.
[13 Mar 2008 17:48] Andrei Elkin
A patch for this bug in on the parent bug page.
[22 Mar 2008 9:34] Andrei Elkin
Pushed to 5.0-rpl.
[31 Mar 2008 7:56] Bugs System
Pushed into 5.1.24-rc
[1 Apr 2008 14:11] Bugs System
Pushed into 5.0.60
[3 Apr 2008 13:01] Bugs System
Pushed into 6.0.5-alpha
[5 Apr 2008 16:24] Jon Stephens
Documented this fix in the 5.0.60, 5.1.24, and 6.0.5 changelogs as follows:

        PURGE BINARY LOGS TO and PURGE BINARY LOGS BEFORE did not handle missing
        binary log files either correctly or in the same way. Now for both of         
        these statements, if any files listed in the .index file are missing from 
        the filesystem, the statement fails with an error.

Also added a note to purge-master-logs about how to handle such situations.