Bug #49841 Bug in master Master Replication
Submitted: 21 Dec 2009 9:06 Modified: 21 Dec 2009 9:42
Reporter: Adam younes Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1.41 OS:Windows (slave not finding master)
Assigned to: CPU Architecture:Any
Tags: master replication, replication, slave fail

[21 Dec 2009 9:06] Adam younes
Description:
i set up master replication and it works fine, but when one server crashes replication does not recover and it stops, i have to stop slave again and change master to with a new log file and pos to make it work again 

error

1 11:01:28 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:28 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:31 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:31 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:33 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:33 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:35 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:35 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:38 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:38 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 314
091221 11:01:40 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:40 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 314

How to repeat:
first server add to my.ini 
[mysqld]
# IP of 2nd Server
report-host=192.168.10.252	
report-user=repadmin
report-password=repadmin
# IP of 1st Server
master-host=192.168.10.206	
master-user=<repadmin>
master-password=<repadmin>
log-bin=C:/Program Files/MySQL/MySQL Server 5.1/bin/mysql-bin.log
server-id=1
auto_increment_increment=10
auto_increment_offset=1

2nd server 

[mysqld]
# IP of 2nd Server
report-host=192.168.10.206	
report-user=repadmin
report-password=repadmin
# IP of 1st Server
master-host=192.168.10.252	
master-user=<repadmin>
master-password=<repadmin>
log-bin=C:/Program Files/MySQL/MySQL Server 5.1/bin/mysql-bin.log
server-id=2
auto_increment_increment=10
auto_increment_offset=2

then restart services 
on both
Grant replication slave on *.* to 'repadmin' identified by 'repadmin';

stop slave; on each 
and run

CHANGE MASTER TO
MASTER_HOST='192.168.10.252',
MASTER_USER='repadmin',
MASTER_PASSWORD='repadmin';

start slaves again

everything seems fine but replication does not work 
and i get this error 

1 11:01:28 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:28 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:31 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:31 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:33 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:33 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:35 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:35 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 106
091221 11:01:38 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:38 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 314
091221 11:01:40 [Note] Slave: received end packet from server, apparent master shutdown: 
091221 11:01:40 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log 'mysql-bin.000035' at postion 314
[21 Dec 2009 9:42] Sveta Smirnova
Thank you for the report.

But if master crashed and its log file changed after start it is expected what slave can not read broken binary file.

If you want slave to not fill error log with similar messages about reconnect please tune option master-retry-count as described at http://dev.mysql.com/doc/refman/5.1/en/replication-options-slave.html#option_mysqld_master...