Bug #104665 DOTs in relay_log and log-bin breaks replication
Submitted: 19 Aug 2021 12:44 Modified: 19 Aug 2021 13:16
Reporter: Kedar Vaijanapurkar Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.7, 5.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql 5.6, MySQL 5.7

[19 Aug 2021 12:44] Kedar Vaijanapurkar
Description:
Replication with relay_log name having two or more dots breaks the replication. Also two or more DOTs in log-bin (binary log) behaves similarly.

Configuring: "relay-log=this.is.relay.log"
Creates: "this.index" and "this.is.relay"
Replication: breaks for first start-slave and works in the next.

Configuring: "relay-log=thisis.relay.log"
Creates: "thisis.index" and "thisis.relay"
Replication: breaks for first start-slave and works in the next.

Configuring: "relay-log=thisisrelay.log"
Creates: "thisisrelay.index" and "thisisrelay.000001"
Replication: OK

This issue also is related with bin-log, if you name a binary log with DOTs, it is behaves the same.

How to repeat:
- Setup standard mysql master-slave replication.

# mysql1
[mysqld]
server-id = 1
binlog_format = MIXED
log-bin
sync_binlog = 1
gtid-mode=ON
enforce-gtid-consistency
relay-log=this.is.relay.log

# mysql2
[mysqld]
server-id = 2
binlog_format = MIXED
log-bin
sync_binlog = 1
gtid-mode=ON
enforce-gtid-consistency
relay-log=this.is.relay.log

- stop slave
- start slave
- show slave status

# You may choose to review the same issue on log-bin variable as well. It behaves the same way. 

--------------
Sample output:
--------------

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

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: mysql1
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: 645d6e993851-bin.000001
          Read_Master_Log_Pos: 2333
               Relay_Log_File: this.is.relay
                Relay_Log_Pos: 2754
        Relay_Master_Log_File: 645d6e993851-bin.000001
             Slave_IO_Running: No
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 2333
              Relay_Log_Space: 2754
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 054d4ac0-0023-11ec-934c-0242ac130002
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-8
            Executed_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-8
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
1 row in set (0.00 sec)

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

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: mysql1
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: 645d6e993851-bin.000001
          Read_Master_Log_Pos: 3565
               Relay_Log_File: this.is.relay
                Relay_Log_Pos: 3161
        Relay_Master_Log_File: 645d6e993851-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 1594
                   Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 123
              Relay_Log_Space: 4501
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 1594
               Last_SQL_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 054d4ac0-0023-11ec-934c-0242ac130002
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State:
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp: 210818 17:18:04
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-12
            Executed_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-8
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
1 row in set (0.00 sec)

mysql> start slave;
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: mysql1
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: 645d6e993851-bin.000001
          Read_Master_Log_Pos: 3565
               Relay_Log_File: this.is.relay
                Relay_Log_Pos: 4501
        Relay_Master_Log_File: 645d6e993851-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 3565
              Relay_Log_Space: 4501
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: 054d4ac0-0023-11ec-934c-0242ac130002
             Master_Info_File: /var/lib/mysql/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-12
            Executed_Gtid_Set: 054d4ac0-0023-11ec-934c-0242ac130002:1-12
                Auto_Position: 1
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
1 row in set (0.00 sec)

Suggested fix:
- Do not let mysqld start for unsupported names provided to start with.
- If we're starting it, consider adding that as a warning in error log.
- If replication decides not to start for the first time, let it not start ever until the issue is fixed, rather than miraculously starting in the next attempt.
[19 Aug 2021 13:14] Kedar Vaijanapurkar
correcting variable name (bin-log to log-bin)
[19 Aug 2021 13:16] MySQL Verification Team
Hello Kedar,

Thank you for the report and feedback.
Imho this is duplicate of Bug #75507, please see Bug #75507.
Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Thank you!

regards,
Umesh