Bug #42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move
Submitted: 3 Feb 2009 23:29 Modified: 1 Apr 2010 6:05
Reporter: Roel Van de Paar Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.0.60sp1, 5.0.67, 5.1.31 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[3 Feb 2009 23:29] Roel Van de Paar
Description:
When relay log files are moved to a different partition (and the correct options are set in my.cnf for relay-log, localhost-relay-bin.index and relay-log.info to match) mysqld is unable to find the relay logs that were in progress after the move.

Any new logs seem to be fine (and contain the full path name in the localhost-relay-bin.index and relay-log.info files). 

Manually editing the localhost-relay-bin.index and relay-log.info files to specify/include the full path name resolves the issue.

How to repeat:
1. Stop mysqld
2. Move the relay log files, localhost-relay-bin.index and relay-log.info to a different partition
3. Set these params in my.cnf:

relay-log = /{path to different partition/dir}/localhost-relay-bin
relay-log-index = /{path to different partition/dir}/localhost-relay-bin.index
relay-log-info-file = /{path to different partition/dir}/relay-log.info

4. Start mysqld

o Results in the following error:

0901xx xx:xx:xx [ERROR] /{path to your MySQL server install}/bin/mysqld: File './localhost-relay-bin.xxxxx0' not found (Errcode: 2)

o Directory contents of {path to different partition/dir} at this point:

-rw-r----- 1 mysql mysql 254 localhost-relay-bin.xxxxx0
-rw-rw---- 1 mysql mysql 117 localhost-relay-bin.xxxxx1
-rw-r----- 1 mysql mysql 96  localhost-relay-bin.index
-rw-r----- 1 mysql mysql 65  relay-log.info

o localhost-relay-bin.index and relay-log.info contents at this point:

localhost-relay-bin.index:
./localhost-relay-bin.xxxxx0
/{path to different partition/dir}/localhost-relay-bin.xxxxx1

relay-log.info:
./localhost-relay-bin.xxxxx0

o When you modify these files to the following:

localhost-relay-bin.index:
/{path to different partition/dir}/localhost-relay-bin.xxxxx0
/{path to different partition/dir}/localhost-relay-bin.xxxxx1

relay-log.info:
/{path to different partition/dir}/localhost-relay-bin.xxxxx0

Replication resumes correctly.

Suggested fix:
o Check for relay log files in same path as localhost-relay-bin.index and relay-log.info if ./ is specified.

o Additionally, it could maybe be a staged fallback if './' is specified: check the directory that contains the .info file for the relay logs, then check the data directory, then check the base directory?

o Also, this error message can be made clearer:

0901xx xx:xx:xx [ERROR] /{path to your MySQL server install}/bin/mysqld: File './localhost-relay-bin.xxxxx0' not found (Errcode: 2)

Instead of giving './' it should have the actual path the server is trying witg, like for instance:

0901xx xx:xx:xx [ERROR] /{path to your MySQL server install}/bin/mysqld: File '{path to different partition/dir}/localhost-relay-bin.xxxxx0' not found (Errcode: 2)

It would be interesting to find out *where exactly* the server is looking at this point for './localhost-relay-bin.xxxxx0' and why (this is likely where the issue is located in the code)
[4 Feb 2009 6:52] Sveta Smirnova
Thank you for the report.

Verified as described.
[1 Apr 2010 6:05] Zhenxing He
This is the same problem as bug#12133 for relay log, mark this as Duplicate