Bug #27070 server logs are created unrequested and in wrong directory
Submitted: 13 Mar 2007 8:24 Modified: 9 Jun 2007 17:52
Reporter: Giuseppe Maxia Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S2 (Serious)
Version:5.1.17, 5.0.40 OS:Linux (Linux, Mac OS X)
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: Logs, Tests, warnings

[13 Mar 2007 8:24] Giuseppe Maxia
Description:
Running the test suite with MySQL 5.1.17 will issue a warning about non pid files being found in the var/run directory.

It seems that the server is creating logs that are not requested in the configuration file.

How to repeat:
1) make sure that $basedir/mysql-test/var/run is empty

2) run a test

./mysql-test-run.pl alias

3) inspect the var/run directory

$ ls var/run/
master.log

4) run the test again

./mysql-test-run.pl alias
...
mysql-test-run: WARNING: Found non pid file master.log in /my_path_to_build/mysql-test/var/run
...

5) more interesting tests to run are rpl000011, log_state, rpl_dual_pos_advance (creates a binary relay-log in var/run)

$ rm -f var/{run,log}/*
$ ./mtr rpl_dual_pos_advance
$ ls -l var/run
var/run/:
total 16
-rw-rw----    1           121 Mar 13 09:19 master-relay-bin.000001
-rw-rw----    1            66 Mar 13 09:19 master-relay-bin.index
-rw-rw----    1           225 Mar 13 09:19 master.log
-rw-rw----    1           224 Mar 13 09:19 slave.log
[13 Mar 2007 19:46] Giuseppe Maxia
More detail on the problem:

using server 5.1.16

mysql> show variables like '%log_file%'\G
*************************** 1. row ***************************
Variable_name: general_log_file
        Value: /usr/local/mysql/data/my_host_name.log
*************************** 2. row ***************************
Variable_name: slow_query_log_file
        Value: /usr/local/mysql/data/my_host_name-slow.log

using version 5.1.17
show variables like '%log%_file'\G
*************************** 1. row ***************************
Variable_name: general_log_file
        Value: /usr/local/mysql/data/my_host_name.pid.log
*************************** 2. row ***************************
Variable_name: slow_query_log_file
        Value: /usr/local/mysql/data/my_host_name.pid-slow.log

notice the ".pid" that should not be there in the log file name.
[19 Mar 2007 10:44] Magnus Blåudd
[msvensson@pilot mysql-test]$ ls var/run/
master-relay-bin.000001  master-relay-bin.index
[20 Mar 2007 16:22] 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/22382

ChangeSet@1.2403, 2007-03-20 11:15:15+01:00, msvensson@pilot.blaudden +1 -0
  Bug#27070 server logs are created unrequested and in wrong directory
  - Setting up a A->B->A replication causes relay logs being written
    by the master, remove them when test is finished
[20 Mar 2007 16:22] 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/22383

ChangeSet@1.2481, 2007-03-20 11:21:27+01:00, msvensson@pilot.blaudden +2 -0
  Bug#27070 server logs are created unrequested and in wrong directory
   - Avoid defaault log file names looking like <hostname>.pid.slow.log
    by using the FN_REPLACE_EXT flag to 'fn_format'
   - Remove the default log files generated by log_state.test before
     test completes
[22 Mar 2007 20:21] Mads Martin Joergensen
Fixed in 5.0.40 and 5.1.17
[23 Mar 2007 10:19] 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/22744

ChangeSet@1.2406, 2007-03-23 11:18:59+01:00, msvensson@pilot.blaudden +1 -0
  Bug#27070 server logs are created unrequested and in wrong directory
   - Add output path for slow queries as well
[23 Mar 2007 12:39] 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/22769

ChangeSet@1.2500, 2007-03-23 13:39:16+01:00, msvensson@pilot.blaudden +1 -0
  Bug #27070  	server logs are created unrequested and in wrong directory
[6 Apr 2007 17:21] Bugs System
Pushed into 5.0.40
[6 Apr 2007 17:23] Bugs System
Pushed into 5.1.18-beta
[24 May 2007 9:34] Magnus Blåudd
Closing this since the originally reported problem has been fixed and pushed.

If log files show up in var/run/ I would say it's by design. The mysqld will when it startup send log files there until it get the instructions from "arguments" to start sending them somewhere else.
[9 Jun 2007 17:52] Paul DuBois
Test suite change. No changelog entry needed.
[25 Oct 2007 8:56] Andrei Elkin
appearance of log files in run directory is explainable with that bug#20166 introduced a new schema for log file name generating via pidname_file.
That led to some consequences which bug#28597 is all about.

The correct fix for this bug is to strip off the directory part of a generated name in MYSQL_LOG::generate_name(). See the bug#28597's patch.