I have a corrupt relay log in MySQL 5.0 and looking for the steps to fix replication without having to reprocess all the binary logs from the master again.
Here is the full error message if you are curious:
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.
The normal fix is quite easy, you just obtain the correct binary log name and position from show slave status and run the change master command. But this is not what I would like to do.
I would like to reprocess only one or few binary logs from the master to recover the corrupted relay log and then continue to use the relay logs that were already created. I am looking for someone who had past experience doing this as there is a potential for failures doing the recovery this way.
Conceptually, I am thinking the following steps might be needed (maybe some of them are optional):
- Stop replication on the slave.
- Shutdown slave instance.
- Move relay logs to a safe location.
- See if relay-log.info or master.info files need to be updated manually.
- Start slave instance.
- Run change master command and reprocess binary logs from the failed position.
- Wait until next relay log is created.
- Stop replication on the slave.
- Shutdown slave instance.
- Figure out how to replace 2nd relay log file with relay logs files that are in the safe location and move them in.
- See if relay-log.info or master.info files need to be updated manually.
- Start slave instance.
- Hope for the best.
I am thinking of an alternate method to do it, which seems much simpler:
- Stop replication on the slave.
- Shutdown slave instance.
- Move relay logs to a safe location.
- Start slave instance.
- Run change master command and reprocess binary logs from the failed position.
- Wait until next relay log is created.
- Stop replication on the slave.
- Use mysqlbinlog to process the relay logs that are in the safe location by piping to mysql client. Identify which file and position to start at. (Potential for issues, unless aborting processing upon first error).
- Set the slave to replicate from master at the read master log file/position.
SHOW SLAVE STATUS\G
still exist on the Master ???