Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4004

Empty variable names allowed and break replication

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5.29
    • 5.5.31
    • None

    Description

      The original description can be found further in this field

      The problem is reproducible with MySQL 5.1-5.6 and filed as http://bugs.mysql.com/bug.php?id=68135.

      A variable can be created with an empty name. Apparently, it's confusing (see the original request below) and potentially error-prone; but it also causes problems with binary logging and replication:

      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.

      Currently it's only reproducible on maria/5.5, but not on maria/5.1, 5.2, 5.3 or 10.0-base. However, I suppose it's just a matter of time, since it came to maria/5.5 with the last mysql-5.1.67 merge, and it exists in all current trees of MySQL.

      Test case:

      --source include/master-slave.inc
      --source include/have_binlog_format_statement.inc
       
      SET @`` = 1;
      CREATE TABLE t1 AS SELECT @`` AS f;
       
      --sync_slave_with_master

      ==================================

      Original description

      I'm not sure if this is a bug or a feature request. Empty names seem to be allowed for variables. No warnings.
      Empty names are not allowed for schemas, tables, columns, views, etc.

       
      MariaDB [test]> SET @`` = 1;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> SELECT @``;
      +------+
      | @``  |
      +------+
      |    1 |
      +------+
      1 row in set (0.07 sec)
       
      MariaDB [test]>
       

      The same happens with local vars in stored routines:

       
      DROP FUNCTION IF EXISTS `test`;
      CREATE FUNCTION `test`()
      	RETURNS BOOLEAN
      BEGIN
      	DECLARE `` TINYINT UNSIGNED;
      	SET `` = 1;
      	RETURN ``;
      END;
       

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              f_razzoli Federico Razzoli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.