# replication problem after master crash

**URL:** <https://forums.percona.com/t/replication-problem-after-master-crash/304>\
**Category:** Other MySQL® Questions\
**Created:** [May 2, 2007, 3:58am UTC](https://forums.percona.com/t/replication-problem-after-master-crash/304 "2007-05-02T03:58:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dyker](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dyker](https://forums.percona.com/u/dyker)\
**Post date:** [May 2, 2007, 3:58am UTC](https://forums.percona.com/t/replication-problem-after-master-crash/304/1 "2007-05-02T03:58:17Z")

</div>

Hi

I have a problem in replication after master server crash. I have one master mysql process and one slave mysql process running on one server. When this server rebooted (after several months uptime) I see the following situation:

On slave in error log:

070501 20:03:35 [Note] Slave SQL thread initialized, starting replication in log ‘database3-bin.000071’ at position 668379575, relay log ‘./database3-relay-bin.000001’ position: 665822307070501 20:03:35 [Note] Slave I/O thread: connected to master ‘slave@d3:3416’, replication started in log ‘database3-bin.000071’ at position 668379575070501 20:03:36 [ERROR] Error reading packet from server: Client requested master to start replication from impossibleposition (server\_errno=1236)070501 20:03:36 [ERROR] Got fatal error 1236: ‘Client requested master to start replication from impossible position’ from master when reading data from binary log070501 20:03:36 [ERROR] Slave I/O thread exiting, read up to log ‘database3-bin.000071’, position 668379575

On slave “SHOW SLAVE STATUS\G”:

Slave\_IO\_State: Master\_Host: d3 Master\_User: slave Master\_Port: 3416 Connect\_Retry: 1 Master\_Log\_File: database3-bin.000071 Read\_Master\_Log\_Pos: 668379575 Relay\_Log\_File: database3-relay-bin.000002 Relay\_Log\_Pos: 4 Relay\_Master\_Log\_File: database3-bin.000071 Slave\_IO\_Running: No 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: 668379575 Relay\_Log\_Space: 4 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

On master “SHOW MASTER LOGS;”:

…| database3-bin.000062 | 1617447 || database3-bin.000063 | 43913303 || database3-bin.000064 | 284939867 || database3-bin.000065 | 1073742101 || database3-bin.000066 | 110044733 || database3-bin.000067 | 1073742071 || database3-bin.000068 | 290598099 || database3-bin.000069 | 126 || database3-bin.000070 | 4 || database3-bin.000071 | 668358853 || database3-bin.000072 | 79 || database3-bin.000073 | 85353363 |

Have anyone this problem? It looks like master doesn’t flushed logs to disk or smth like this…

PS  
sorry for my english I’m not a native speaker 😉

---

<div class="post-metadata">

**Author:** ![sterin](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@sterin](https://forums.percona.com/u/sterin)\
**Post date:** [May 2, 2007, 12:41pm UTC](https://forums.percona.com/t/replication-problem-after-master-crash/304/2 "2007-05-02T12:41:42Z")

</div>

I think you are correct.

For some reason your binary log file is shorter than what the slave is expecting.

You didn’t say what happened when the master crashed.  
Was it just MySQL or was it the entire OS?

Either way you have ended up with that the slave is requesting a position in the binary log on the master that is of the end of the file.

So you must perform a re-syncronization between the master and slave to sort this out.

---

<div class="post-metadata">

**Author:** ![dyker](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@dyker](https://forums.percona.com/u/dyker)\
**Post date:** [May 3, 2007, 4:41am UTC](https://forums.percona.com/t/replication-problem-after-master-crash/304/3 "2007-05-03T04:41:30Z")

</div>

| [B]sterin wrote on Thu, 03 May 2007 01:11[/B] |
| I think you are correct.

For some reason your binary log file is shorter than what the slave is expecting.

You didn’t say what happened when the master crashed.  
Was it just MySQL or was it the entire OS?

 |

It was a server reboot (power problems or smth like this)

| [B]sterin wrote on Thu, 03 May 2007 01:11[/B] |
| 

Either way you have ended up with that the slave is requesting a position in the binary log on the master that is of the end of the file.

So you must perform a re-syncronization between the master and slave to sort this out.

 |

JFYI:  
I found this in mysql documentation may be it helps somebody else:

| [B]Quote:[/B] |
| 

A crash on the master side can result in the master’s binary log having a final position less than the most recent position read by the slave, due to the master’s binary log file not being flushed. This can cause the slave not to be able to replicate when the master comes back up. Setting sync\_binlog=1 in the master my.cnf file helps to minimize this problem because it causes the master to flush its binary log more frequently.

 |

I'll try this.
