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

mariabackup --lock-ddl-per-table fails when table names contain backticks

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2.9
    • Fix Version/s: 10.2.9
    • Component/s: Backup
    • Labels:
      None

      Description

      The mariabackup --lock-ddl-per-table option is not quoting schema and table names properly, as can be demonstrated with this modified version of the test mariabackup.lock_ddl_per_table:

      --source include/have_debug.inc
       
      CREATE TABLE `t``;drop table mysql.user;` (i INT) ENGINE INNODB;
      INSERT INTO `t``;drop table mysql.user;` VALUES(1);
      echo # xtrabackup backup;
      let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
       
      --disable_result_log
      exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --lock-ddl-per-table=1 --dbug=+d,check_mdl_lock_works;
      --enable_result_log
      DROP TABLE `t``;drop table mysql.user;`;
      rmdir $targetdir;
      

      The test will fail as follows:

      170914 09:03:18 Locking MDL for `test`.`t`;drop table mysql.user;`
      Error: failed to execute query SELECT * FROM `test`.`t`;drop table mysql.user;` LIMIT 0: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'drop table mysql.user;` LIMIT 0' at line 1
      170914 09:03:18 Connecting to MySQL server host: localhost, user: root, password: set, port: 16000, socket: /mariadb/10.2/build/mysql-test/var/tmp/mysqld.1.sock
      mariabackup: /mariadb/10.2/extra/mariabackup/backup_mysql.cc:1663: void check_mdl_lock_works(const char *): Assertion `err_no == 1969' failed.
      

      The bug is in mdl_lock_table(), which fails to escape literal ` characters into `` in when constructing full_table_name.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                wlad Vladislav Vaintroub
                Reporter:
                marko Marko Mäkelä
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: