Bug #12133 | master.index file keeps mysqld from starting if bin log has been moved | ||
---|---|---|---|
Submitted: | 23 Jul 2005 18:44 | Modified: | 19 Dec 2011 12:18 |
Reporter: | Jonathan Miller | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S2 (Serious) |
Version: | 5.0, 5.1 | OS: | Linux (Linux) |
Assigned to: | Zhenxing He | CPU Architecture: | Any |
[23 Jul 2005 18:44]
Jonathan Miller
[31 Jul 2005 20:26]
Jorge del Conde
Hi! I was able to reproduce this under FC4 using 5.0 from bk
[5 Sep 2006 7:05]
Nathan Oorloff
I'm using 5.0.24 on Debian Sarge (3.1) x86. I came across this bug when I wanted to move my binary logs from the default location of my data directory (/var/lib/mysql/) and give them their own folder (/var/lib/mysql/binlog/). Steps: 1) Stopped the server 2) Edited the path of the binlog files in my.cnf 3) Copied all the existing binlogs into that folder (including the index). I checked the index to see if it needed changing but it said './mysql-bin.0000X' for the logs which was still right 4) Restarted the server It gave me the following error (from mysql-bin-error.log): **************************************************** 060905 14:45:24 mysqld started 060905 14:45:24 InnoDB: Started; log sequence number 0 43665 /usr/local/mysql/bin/mysqld: File './mysql-bin.000017' not found (Errcode: 2) 060905 14:45:24 [ERROR] Failed to open log (file './mysql-bin.000017', errno 2) 060905 14:45:24 [ERROR] Could not open log file 060905 14:45:24 [ERROR] Can't init tc log 060905 14:45:24 [ERROR] Aborting 060905 14:45:24 InnoDB: Starting shutdown... 060905 14:45:26 InnoDB: Shutdown completed; log sequence number 0 43665 060905 14:45:26 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete 060905 14:45:26 mysqld ended ******************************************* I spent probably 1/4 a day searching for the answer to this problem when I realised that if I deleted the existing logs the new binlog index gave the full path of the file rather than './mysql-bin.000017'. I restored the old binlogs from backup, put them in a new folder and gave the full path name to all the entries in the index and everything worked fine. I would suggest if this bug isn't going to be fixed anytime soon perhaps a note could be added in the binary log section of the manual about this problem as that would've saved me hours of searching when I came across the issue (the binary log manual was the first page I looked). Thanks, Nathan.
[24 Jan 2008 19:02]
Omer Barnir
workaround: remove/edit entries from index file when moving the binlog files
[1 Apr 2010 6:04]
Zhenxing He
Bug#42576 is the same problem for relay log, will fix both case in this bug.
[11 Jan 2011 7:28]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/128384 3481 He Zhenxing 2011-01-11 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files.
[11 Jan 2011 7:37]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/128385 3481 He Zhenxing 2011-01-11 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files.
[12 Jan 2011 5:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/128473 3481 He Zhenxing 2011-01-12 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files. When reading an index file that was generated by a server before the fix, the directory part will be stripped before calculating the path. @ mysql-test/include/setup_fake_relay_log.inc After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file. @ mysql-test/suite/rpl/t/rpl_manual_change_index_file.test After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file.
[14 Jan 2011 16:06]
Luis Soares
See also: BUG#55460.
[14 Jan 2011 16:11]
Luis Soares
See also: BUG#57771.
[17 Jan 2011 8:41]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/128897 3481 He Zhenxing 2011-01-17 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files. When reading an index file that was generated by a server before the fix, the directory part will be stripped before calculating the path. @ mysql-test/include/setup_fake_relay_log.inc After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file. @ mysql-test/suite/rpl/t/rpl_manual_change_index_file.test After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file.
[25 Jan 2011 10:24]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/129534 3481 He Zhenxing 2011-01-25 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files. When reading an index file that was generated by a server before the fix, the directory part will be stripped before calculating the path. @ mysql-test/include/setup_fake_relay_log.inc After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file. @ mysql-test/suite/rpl/t/rpl_manual_change_index_file.test After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file.
[26 Jan 2011 7:56]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/129620 3481 He Zhenxing 2011-01-26 BUG#12133 master.index file keeps mysqld from starting if bin log has been moved Absolute path or relative path to the data directory was recorded in the binlog or relay log index files, which caused the server unable to locate the log files and failed to start when user moved the binlog or relay log files to another directory and restart the server with binlog or relay log option set to the new path. Fixed the problem by only record the basename in the binlog or relay log index files, and use the directory of the binlog or relay log option to calculate the path to access the log files. When reading an index file that was generated by a server before the fix, the directory part will be stripped before calculating the path. @ mysql-test/include/begin_include_file.inc Add $keep_silent to suppress the output of the include line. @ mysql-test/include/setup_fake_relay_log.inc After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file. @ mysql-test/suite/rpl/t/rpl_manual_change_index_file.test After fix of BUG#12133, there is no need to prepend ./ or .\ for filenames in the binlog or relay log index file.
[15 Dec 2011 9:38]
Jon Stephens
BUG#42576 is a duplicate is this bug.
[19 Dec 2011 12:18]
Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at http://dev.mysql.com/doc/en/installing-source.html
[19 Dec 2011 12:18]
Jon Stephens
Documented bugfix and behaviour change in the 5.5.20 and 5.6.5 changelogs as follows: Moving the binary log file, relay log file, or both files to a new location, then restarting the server with a new value for --log-bin, --relay-log, or both, caused the server to abort on start. This was because the entries in the index file overrode the new location. In addition, paths were calculated relative to datadir (rather than to the --log-bin or --relay-log values). The fix for this problem means that, when the server reads an entry from the index file, it now checks whether the entry contains a relative path. If it does, the relative part of the path is replaced with the absolute path set using the --log-bin or --relay-log option. An absolute path remains unchanged; in such a case, the index must be edited manually to enable the new path or paths to be used. Also updated the descriptions of the referenced options in the 5.5/5.6 Manuals. Closed.