mysqlguy.net

Faster way to find the next valid position in a relay log?

I'm working on an implementation of a mysql slave precache tool as described by Paul Tuckfield at last year's User conference.

I can easily tell where the SQL Thread is currently is reading from in the local relay log, but it's a harder problem to solve when I want to scan ahead in that log some number of binlog entries and find a valid position. I can simply add to the position some number of bytes, but then I have to stop and loop through calls to 'mysqlbinlog' until I get a position that doesn't throw an error.

This turns out to be a pretty expensive operation, and I'm having a problem where by the time I find a good position and can start my precacher, the slave is already past me!

Does anyone have any clever ways to find good binary log positions besides this (this is in ruby, in case you're wondering):

def mysqlbinlog_cmd( position, length )

Starting again...

It's not that I've really posted that much at http://mysqlguy.blogspot.com, but I wanted someplace that was a little more permanent going forward.  The reason should become clear hopefully later this month, but let's just say I've been working out some details to allow me to contribute directly to the MySQL community in some tangible ways.  In any case, stay tuned here.

About Me

Jay Janssen
Yahoo!, Inc.
jayj at yahoo dash inc dot com
MySQL
High Availability
Global Load Balancing
Failover
View Jay Janssen on Twitter  View Jay Janssen's LinkedIn profile View Jay Janssen's Facebook profile