Bug #55460 CHANGE MASTER TO cannot find target relay log file using relative path
Submitted: 21 Jul 2010 21:50 Modified: 17 Jan 2011 8:03
Reporter: Matthew Montgomery Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:mysql-5.1.48 OS:Linux
Assigned to: Luis Soares CPU Architecture:Any

[21 Jul 2010 21:50] Matthew Montgomery
Description:
CHANGE MASTER TO is not accepting relative path for relay_log_file without ./  prefixed onto log file name.

Setting relay_log=`host`-relay-bin does not have an impact.  
Setting relay_log=/full/path/to/`host`-relay-bin

At a minimum this is a documentation bug since http://dev.mysql.com/doc/refman/5.1/en/change-master-to.html never mentions the "./relay-log-bin.000001" notation.

This behavior is mentioned also in Bug #42879 which received a fix pushed in 5.1.33 but is still "Verified" 

How to repeat:
mysql> slave stop;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 192.168.23.22
                  Master_User: repl
                  Master_Port: 3370
                Connect_Retry: 60
              Master_Log_File: silo-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: silo-relay-bin.000002
                Relay_Log_Pos: 4
        Relay_Master_Log_File: silo-bin.000001
             Slave_IO_Running: No
            Slave_SQL_Running: No
[...]
mysql> change master to relay_log_file='silo-relay-bin.000003', relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization
mysql> \! ls -l data/silo-relay-bin.000003
-rw-rw---- 1 matt matt 106 2010-07-21 16:16 data/silo-relay-bin.000003
mysql> show variables like 'relay%';
+-----------------------+----------------+
| Variable_name         | Value          |
+-----------------------+----------------+
| relay_log             |                |
| relay_log_index       |                |
| relay_log_info_file   | relay-log.info |
| relay_log_purge       | OFF            |
| relay_log_space_limit | 0              |
+-----------------------+----------------+
5 rows in set (0.00 sec)

mysql> show variables like 'datadir'; 
+---------------+---------------------------------------+
| Variable_name | Value                                 |
+---------------+---------------------------------------+
| datadir       | /home/matt/mysql/sandbox/5.1.48/data/ |
+---------------+---------------------------------------+
1 row in set (0.00 sec)

mysql> show variables like 'basedir'; 
+---------------+-----------------------------+
| Variable_name | Value                       |
+---------------+-----------------------------+
| basedir       | /data/mysql/sandbox/5.1.48/ |
+---------------+-----------------------------+
1 row in set (0.00 sec)

mysql> change master to relay_log_file='/home/matt/mysql/sandbox/5.1.48/data/silo-relay-bin.000003', relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization

mysql> change master to relay_log_file='./silo-relay-bin.000003', relay_log_pos=0; 
Query OK, 0 rows affected (0.00 sec)

mysql> slave start;
Query OK, 0 rows affected (0.00 sec)

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.23.22
                  Master_User: repl
                  Master_Port: 3370
                Connect_Retry: 60
              Master_Log_File: silo-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: silo-relay-bin.000004
                Relay_Log_Pos: 251
        Relay_Master_Log_File: silo-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
[...]

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.23.22
                  Master_User: repl
                  Master_Port: 3370
                Connect_Retry: 60
              Master_Log_File: silo-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: silo-relay-bin.000007
                Relay_Log_Pos: 251
        Relay_Master_Log_File: silo-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
[...]

mysql> slave stop; 
Query OK, 0 rows affected (0.00 sec)

mysql> \! ls data 
ibdata1      master.info     silo-bin.000001  silo-bin.000004  silo.err      silo-relay-bin.000006  test
ib_logfile0  mysql	     silo-bin.000002  silo-bin.000005  silo.err-old  silo-relay-bin.000007
ib_logfile1  relay-log.info  silo-bin.000003  silo-bin.index   silo.pid      silo-relay-bin.index
mysql> show variables like 'relay%';
+-----------------------+----------------------+
| Variable_name         | Value                |
+-----------------------+----------------------+
| relay_log             | silo-relay-bin       |
| relay_log_index       | silo-relay-bin.index |
| relay_log_info_file   | relay-log.info       |
| relay_log_purge       | ON                   |
| relay_log_space_limit | 0                    |
+-----------------------+----------------------+
5 rows in set (0.00 sec)

mysql> change master to relay_log_file='silo-relay-bin.000006',relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization
mysql> change master to relay_log_file='/data/mysql/sandbox/5.1.48/data/silo-relay-bin.000006', relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization
mysql> change master to relay_log_file='./silo-relay-bin.000006', relay_log_pos=0; 
Query OK, 0 rows affected (0.00 sec)

mysql> slave start;

Query OK, 0 rows affected (0.00 sec)
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.23.22
                  Master_User: repl
                  Master_Port: 3370
                Connect_Retry: 60
              Master_Log_File: silo-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: silo-relay-bin.000006
                Relay_Log_Pos: 251
        Relay_Master_Log_File: silo-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
[...]

With relay_log=/full/path/to/`host`-relay-bin

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.23.22
                  Master_User: repl
                  Master_Port: 3370
                Connect_Retry: 60
              Master_Log_File: silo-bin.000001
          Read_Master_Log_Pos: 107
               Relay_Log_File: silo-relay-bin.000011
                Relay_Log_Pos: 251
        Relay_Master_Log_File: silo-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
[...]
mysql> slave stop sql_thread; 
Query OK, 0 rows affected (0.00 sec)

mysql> flush logs; 
\Query OK, 0 rows affected (0.45 sec)

mysql> \! ls data/silo-relay-bin* 
data/silo-relay-bin.000010  data/silo-relay-bin.000011	data/silo-relay-bin.000012  data/silo-relay-bin.index
mysql> slave stop; 
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'relay%';
+-----------------------+------------------------------------------------------+
| Variable_name         | Value                                                |
+-----------------------+------------------------------------------------------+
| relay_log             | /data/mysql/sandbox/5.1.48/data/silo-relay-bin       |
| relay_log_index       | /data/mysql/sandbox/5.1.48/data/silo-relay-bin.index |
| relay_log_info_file   | relay-log.info                                       |
[...]
mysql> change master to relay_log_file='silo-relay-bin.000011', relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization
mysql> change master to relay_log_file='./silo-relay-bin.000011', relay_log_pos=0; 
ERROR 1380 (HY000): Failed initializing relay log position: Could not find target log during relay log initialization
mysql> change master to relay_log_file='/data/mysql/sandbox/5.1.48/data/silo-relay-bin.000011', relay_log_pos=0; 
Query OK, 0 rows affected (0.00 sec)
[14 Jan 2011 15:52] 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/128818

3289 Luis Soares	2011-01-14
      BUG#55460: CHANGE MASTER TO cannot find target relay log file 
      using relative path
      
      Sketch of test cases.
[14 Jan 2011 16:06] Luis Soares
See also: BUG#12133.
[14 Jan 2011 16:09] Luis Soares
The test case:
- http://lists.mysql.com/commits/128818

Succeeds on a tree patched with patch for BUG#12133.
[17 Jan 2011 8:03] Zhenxing He
Dup of bug#12133