Bug #68135 Empty name for user variable is allowed and breaks statement binary logging
Submitted: 21 Jan 2013 21:42 Modified: 31 Jan 2013 11:10
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1, 5.5.29, 5.6.9 OS:Any
Assigned to: CPU Architecture:Any

[21 Jan 2013 21:42] Elena Stepanova
Description:
I'm setting it to 'Replication' for now, but originally our user filed it as a general server bug, noticing that currently empty variable names are allowed which, apparently, is confusing (and I guess potentially error-prone, e.g. if an application fails to populate a variable name). Since MySQL documentation does not specify explicitly whether it should be so, it would have been a feature request, but it turns out that it already causes serious troubles on the server side:

SET @`` = 1;
CREATE TABLE t1 AS SELECT @`` AS f;
SHOW BINLOG EVENTS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error

Consequently, replication fails with ER_SLAVE_RELAY_LOG_READ_FAILURE. 

Please consider whether it should be solved on the binary logging side, or rules for user variable names should be stricter, and update the category if needed.

How to repeat:
# The test can also be run with replication, 
# then --sync_slave_with_master fails 
# due to ER_SLAVE_RELAY_LOG_READ_FAILURE

--source include/have_binlog_format_mixed_or_statement.inc

SET @`` = 1;
CREATE TABLE t1 AS SELECT @`` AS f;
SHOW CREATE TABLE t1;
SHOW BINLOG EVENTS;
[21 Jan 2013 22:06] Elena Stepanova
Updated versions from generic 5.5 / 5.6 to 5.5.29 / 5.6.9 as it looks like it might be a recent regression.
[22 Jan 2013 6:40] Erlend Dahl
Thank you for the bug report. Reproducible on latest 5.6.
[22 Jan 2013 6:58] Peter Laursen
Also in 5.1.36 empty user variable names are allowed
[31 Jan 2013 11:10] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[31 Jan 2013 11:18] Jon Stephens
Fixed in 5.1+. Documented in the 5.1.69, 5.5.31, 5.6.11, and 5.7.1 changelogs as follows:

A zero-length name for a user variable was incorrectly considered to be a sign of data corruption and thus was not written to the binary log.

closed.