Bug #44700 mysqlbinlog always outputs a BASE64 header
Submitted: 6 May 2009 16:14 Modified: 12 May 2009 16:51
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1 OS:Linux
Assigned to: Paul DuBois CPU Architecture:Any

[6 May 2009 16:14] Andrew Hutchings
Description:
When using mysqlbinlog in MySQL 5.1 a BASE64 of the header is always output.  There appears to be no documented reason for this:

# at 4
#090427 20:59:31 server id 1  end_log_pos 98 	Start: binlog v 4, server v 5.0.
67-debug-log created 090427 20:59:31 at startup
ROLLBACK/*!*/;
BINLOG '
ow72SQ8BAAAAXgAAAGIAAAAAAAQANS4wLjY3LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACjDvZJEzgNAAgAEgAEBAQEEgAASwAEGg==
'/*!*/;
# at 98

Manually decoded:

��I���^���b������5.0.67-debug-log������������������������������������I8
�����K�

This appears to be the log header without BINLOG_MAGIC.  It appears to do nothing in the mysql client (possibly ignored?).

This even happens with --start-position set.  The only workaround I can see --base64-output=never.

How to repeat:
mysqlbinlog mylogfile-bin.000001

Suggested fix:
Either skip this output or document a reason for it.
[11 May 2009 19:01] Mats Kindahl
The header is the format description log event that is associated with the binary log being dumped. It is necessary to decode some row events correctly and is therefore needed for any binary log that contain such. Since it is not possible to know in advance, the default is to output that header first.

If the binary log is known to not contain any events requiring a BINLOG statement (that is, no row events), the --base64-output=never can be used to prevent this header from being written.

For more information, check BUG#32407, which introduces this.
[11 May 2009 19:03] Mats Kindahl
Setting this bug to documentation, since it appears to be a documentation issue. Please reset the status if that is not the case.
[11 May 2009 19:18] Paul DuBois
Reclassifying as Server:Documentation and assigning to myself.
[12 May 2009 16:51] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Added the following text to http://dev.mysql.com/doc/refman/5.1/en/mysqlbinlog-row-events.html:

Proper interpretation of row events requires the information from the
format description event at the beginning of the binary log. Because
mysqlbinlog does not know in advance whether the rest of the log
contains row events, by default it displays the format description
event using a BINLOG statement in the initial part of the output.

If the binary log is known not to contain any events requiring a
BINLOG statement (that is, no row events), the --base64-output=NEVER
option can be used to prevent this header from being written.