[MDEV-13802] mariabackup --lock-ddl-per-table fails when table names contain backticks Created: 2017-09-14  Updated: 2017-09-17  Resolved: 2017-09-17

Status: Closed
Project: MariaDB Server
Component/s: Backup
Affects Version/s: 10.2.9
Fix Version/s: 10.2.9

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-13563 lock DDL for mariabackup in 10.2+ Closed

 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.


Generated at Thu Feb 08 08:08:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.