Bug #74257 request for mysqlbinlog - option to read from binlog until it switches to new
Submitted: 7 Oct 2014 23:27
Reporter: Ben Krug Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Utilities: Binlog Events Severity:S4 (Feature request)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[7 Oct 2014 23:27] Ben Krug
Description:
mysqlbinlog in 5.6 lacks a feature in relation to reading a binlog on a remote server.  There's the --stop-never option that just keeps reading, but I'd like there to be an option that reads continuously until the servers active binlog is full and switches to a new binlog.

This would be useful for automating backups with scripts - it would allow mysqlbinlog to create a copy of a binlog until it's full, exit, allow the user to make a backup of the active log and then restart mysqlbinlog and start copying the next file. So, instead of --stop-never maybe like a --stop-at-end or something similar.

Basically we'd like to have the possibility to send a binlog to netbackup as soon as it's full, and mysql switches to the next one. There is an old feature request asking to have this functionality in the server, but using mysqlbinlog with --read-from-remote-server can give us the same functionality without changing how the server works.

What we can do today is to use mysqlbinlog with --read-from-remote-server and --never-stop. This simply switches to the next binlog as soon as the old one is done with no "break", so we don't actually know when it happens.
The other option is to just use --read-from-remote-server, this gives us the binlog as it is and then exits, still leaving it up to us to guess when the binlog is done.

If there was an option like "--stop-at-end" or something similar to that, that continues to read the active binlog until it's done and then exits, it would give us the chance to submit the binlog to netbackup with a simple shellscript before starting to read the next one.

Our main problem is that mysql silently switches binlog. There is no way to know when it has happened outside of the server. An added feature like this in mysqlbinlog would solve the problem without having to change anything in mysqld. 

How to repeat:
check mysqlbinlog options for --read-from-remote-server

Suggested fix:
add new option, eg, --stop-at-log-end