Home » Performance » MySQL » Skipping Errors in Binary Log with mysqlbinlog
Skipping Errors in Binary Log with mysqlbinlog [message #3078] Wed, 14 May 2008 10:01 Go to next message
james  is currently offline james
Messages: 11
Registered: September 2007
Location: Arlington, TX
Junior Member

Short Version:

When running...

mysqlbinlog mysql-bin.000123 | tee progress.000123 | mysql

...we encounter SQL errors (duplicate key). How can we get it to skip those errors and continue processing the binary log instead of stopping and exiting?

Long Version:

I recently had a hardware failure (bad sectors on a disk) that resulted in MySQL crashing and a corrupted ib_logfile. We were unable to run MySQL without setting force-innodb-recovery=6. Even with this setting set, we were unable to read data out of our largest table because it was in an inconsistent state without the logged transactions.

I'm attempting to recover from a month-old backup and binary logs. It's going smoothly except for the following problem:

On occasion, MySQL reports a duplicate key error when executing one of the queries, which causes mysqlbinlog to stop reading the log. We are running the processes like so:

mysqlbinlog mysql-bin.000123 | tee progress.000123 | mysql

When this dies with the duplicate key error, I tail progress.000123, find the start of the last transaction in that file (which may mean we missed a few transactions, which is okay), and start executing again with a --start-position of where we left off.

I don't know why there are errors at all in the binary log unless transactions were recorded twice in the log, but the pressing question is how can we get it to continue on after receiving an error? We have 38 GB of logs, and when it gets stuck in the middle of the night, it just extends how long it is taking us to get back up and running.

Thanks in advance; I've been searching for a solution for about a week since we started the recovery.
Re: Skipping Errors in Binary Log with mysqlbinlog [message #3081 is a reply to message #3078 ] Wed, 14 May 2008 19:50 Go to previous messageGo to next message
bseenu  is currently offline bseenu
Messages: 1
Registered: May 2008
Junior Member
you can collect all your binlog statements in the file progress.000123 and then use some script to add the following to all the insert statements

ON DUPLICATE KEY IGNORE

HTH,

-srini
Re: Skipping Errors in Binary Log with mysqlbinlog [message #3085 is a reply to message #3078 ] Fri, 16 May 2008 04:47 Go to previous message
debug  is currently offline debug
Messages: 82
Registered: March 2008
Member

Actually mysqlbinlog does not stop after error, mysqlbinlog just converts log file to text format, nothing more. The problem is that mysql client stops after error. Please try 'mysql -f'.

[Updated on: Fri, 16 May 2008 04:47]


Mikhail Solovyev, MySQL Performance Expert
MySQL Performance Blog
MySQL Consulting
Previous Topic:MySQL take too much time to start
Next Topic:Lookup Tables not Using Indexes?
Goto Forum:
  



Current Time: Thu Jul 3 19:56:32 EDT 2008

Total time taken to generate the page: 0.00812 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge