Bug #29165 Replication does not start up if binlog file is at very last position
Submitted: 17 Jun 2007 22:10 Modified: 18 Jun 2008 18:15
Reporter: Markus Popp Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1.19 OS:Any
Assigned to: Markus Popp CPU Architecture:Any

[17 Jun 2007 22:10] Markus Popp
Description:
The replication slave seems to have problems taking up replication from the very end of a binlog file.

Here's the master status from the replication master:

mysql> show master status;
+--------------------+----------+-------------------------------------------------+------------------+
| File               | Position | Binlog_Do_DB           | Binlog_Ignore_DB |
+--------------------+----------+-------------------------------------------------+------------------+
| db4free-bin.000208 |  5676589 | db4free_webapp1,db4free_webapp2,db4free_webapp3 |                  |
+--------------------+----------+-------------------------------------------------+------------------+
1 row in set (0.03 sec)

The current binlog file is db4free-bin.000208.

On my replication slave, I have this slave status:

mysql> show slave status\G
*************************** 1. row ***************************
...
              Master_Log_File: db4free-bin.000205
          Read_Master_Log_Pos: 15027057
...
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
              Replicate_Do_DB: db4free_webapp1,db4free_webapp2,db4free_webapp3
...
1 row in set (0.00 sec)

So replication stopped at position 15027057 of binlog file 'db4free-bin.000205'.

The error log of my slave tells me the following:

070617 21:59:36 [Note] Slave I/O thread: connected to master 'xxx@db4free.net:3306',replication started in log 'db4free-bin.000205' at position 15027057
070617 21:59:36 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
070617 21:59:36 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' from master when reading data from binary log
070617 21:59:36 [Note] Slave I/O thread exiting, read up to log 'db4free-bin.000205', position 15027057

If I look into the binlog files themselves (on the master) I get this:

# mysqlbinlog db4free-bin.000205 | tail
                                        where guid='1ec7bba11ebca0467191f6749e4d801d'/*!*/;
# at 15026851
#7616 14:10:30 server id 1433567391  end_log_pos 15027057       Query thread_id=560121        exec_time=1     error_code=0
SET TIMESTAMP=1181995830/*!*/;
update db4free_langlog set count_acc = count_acc + 1, timestamp = now()
                                        where guid='a31d9f7943eadeccb3daf16f912600ad'/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;

15027057 is at the very end of this binlog file.

The beginning of the next binlog fine looks OK though:

# mysqlbinlog db4free-bin.000206 | head
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#7614 17:42:53 server id 1433567391  end_log_pos 106    Start: binlog v 4, server v 5.1.19-beta-log created 7614 17:42:53 at startup
ROLLBACK/*!*/;
# at 106
#7614 17:42:55 server id 1433567391  end_log_pos 125    Stop
DELIMITER ;
# End of log file

How to repeat:
Still analyzing ...