Bug #28850 relay-log uses wrong path
Submitted: 2 Jun 2007 10:39 Modified: 4 Dec 2007 6:54
Reporter: Nigel Kukard Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S2 (Serious)
Version:5.0.41, 5.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[2 Jun 2007 10:39] Nigel Kukard
Description:
Docs/mysql.info - line 31129                                                                                                                                           
By default, the slave server creates                                                                                                                                   
relay log files in its data directory. The default filenames can be                                                                                                    
overridden with the `--relay-log' and `--relay-log-index' server                                                                                                       
options. See *Note replication-options::.             

sql/log.cc - line 445, takes the PID file name and creates log file name, it doesn't use the datadir                                                                                               
libmysqld/log.cc - line 445, same here                                                                                                                                      
                                                                                                                                                                       

On some operating systems /var/run/mysqld is used for the mysql socket and the mysql.pid file. This directory is cleaned out when the system is rebooted.

Seeing as mysql uses the pid file directory, it could end up sticking the relay logs in this directory, the server can be rebooted and the logs removed causing problems.

How to repeat:
Here is the config file...

[mysqld]
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysql.sock
user=mysql

report-host=myhost
server-id=102

#replicate-do-db=testdb

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[13 Jun 2007 15:39] Wayne Gemmell
I have had the same problem with version 5.0.38. For something this serious to last this long in mysql you could almost call it a feature.
[27 Jun 2007 19:54] Sveta Smirnova
Thank you for the report.

Verified as described. Version 5.1 is affected too.
[6 Jul 2007 19:17] Lenz Grimmer
This bug has also been reported on LaunchPad: ttps://bugs.launchpad.net/bugs/119271
[24 Jul 2007 17:41] David Sparks
Note this bug also affects the location of the slow query log:

# ls -dl /var/run/mysqld/mysqld-slow.log
-rw-rw---- 1 mysql mysql 22588 Jul 24 09:56 /var/run/mysqld/mysqld-slow.log

Why isn't this bug on the open bugs page?  I upgraded a server which blew up because /var/run is on a very small partition (the binary logs not the slow query log caused the partition to fill up).

http://dev.mysql.com/doc/refman/5.0/en/open-bugs.html
[7 Sep 2007 15:58] Alessandro Polverini
I can confirm the problem, my / partition filled up because of the relay files going to /var/run/mysql instead of the data dir
[26 Oct 2007 12:52] Micke Engblom
This also breaks replication when slave server is rebooted since /var/run/ is cleaned out hence loosing the relay logs which prevents the slave from resuming replication. This issue still exists in 5.0.45.
[28 Nov 2007 11:46] Mats Kindahl
This is a serious bug and should be treated with urgency. Just a summary of how the server should handle the files.

The binary logs should be treated with the same caution as the real table data since they are necessary to do a point-in-time recovery.

The master and relay-log info files are necessary to the state of replication, while the relay log represents cached data. Neither should be treated as run-time data since they potentially can be needed for recovery of replication. The contents of the relay log can be reproduced from the binary log on the master, but that requires knowing the last applied master log position (which is in the master.info file).

Neither the general log, the slow log, nor the error log should be treated as run-time info either. They should be treated with the same caution as, e.g., the syslog file. They represent audit information, and can be needed to investigate the performance or behavior of the server.

All of these are currently stored under the data directory, but it is advisable to differentiate between the different uses and requirements on the files.
[4 Dec 2007 6:54] Zhenxing He
duplicate for bug#28597