diff --git a/mysql-test/suite/group_replication/r/gr_special_name.result b/mysql-test/suite/group_replication/r/gr_special_name.result new file mode 100644 index 00000000000..6171df16936 --- /dev/null +++ b/mysql-test/suite/group_replication/r/gr_special_name.result @@ -0,0 +1,58 @@ +include/group_replication.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection server1] +server1 +include/start_and_bootstrap_group_replication.inc +INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; +CREATE DATABASE `te``st`; +CREATE TABLESPACE `ts``1`; +CREATE TABLE `t``1` (a INT PRIMARY KEY , b INT); +INSERT INTO `t``1` VALUES (1,1); +server2 +include/start_group_replication.inc +INSTALL PLUGIN clone SONAME 'CLONE_PLUGIN'; +SET SESSION group_replication_consistency='BEFORE'; +SELECT * FROM `t``1`; +a b +1 1 +include/stop_group_replication.inc +[connection server2] +include/spawn_monitoring_process.inc +server1 +INSERT INTO `t``1` VALUES (2,2); +INSERT INTO `t``1` VALUES (3,3); +server2 +SET GLOBAL group_replication_clone_threshold=1; +START GROUP_REPLICATION; +include/rpl_reconnect.inc +include/start_group_replication.inc +include/gr_wait_for_member_state.inc +server2 +SELECT * FROM `t``1`; +a b +1 1 +2 2 +3 3 +[connection server2] +include/clean_monitoring_process.inc +UNINSTALL PLUGIN clone; +DROP DATABASE `te``st`; +DROP TABLESPACE `ts``1`; +DROP TABLE `t``1`; +RESET PERSIST IF EXISTS group_replication_group_name; +RESET PERSIST IF EXISTS group_replication_local_address; +RESET PERSIST IF EXISTS group_replication_group_seeds; +set session sql_log_bin=0; +call mtr.add_suppression("Started with --core-file and --coredumper. --coredumper will take precedence."); +call mtr.add_suppression("Plugin group_replication reported: 'This member will start distributed recovery using clone."); +call mtr.add_suppression("Clone removing all user data for provisioning: Started"); +call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); +set session sql_log_bin=1; +[connection server1] +UNINSTALL PLUGIN clone; +DROP DATABASE `te``st`; +DROP TABLESPACE `ts``1`; +DROP TABLE `t``1`; +include/group_replication_end.inc diff --git a/mysql-test/suite/group_replication/t/gr_special_name.test b/mysql-test/suite/group_replication/t/gr_special_name.test new file mode 100644 index 00000000000..5566215c5b9 --- /dev/null +++ b/mysql-test/suite/group_replication/t/gr_special_name.test @@ -0,0 +1,92 @@ +--source include/have_mysqld_monitoring_process.inc +--source include/have_clone_plugin.inc +--source include/have_group_replication_plugin.inc +--let $rpl_skip_group_replication_start= 1 +--source include/group_replication.inc + +--connection server1 +--echo server1 +--source include/start_and_bootstrap_group_replication.inc +--replace_result $CLONE_PLUGIN CLONE_PLUGIN +--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' +CREATE DATABASE `te``st`; +CREATE TABLESPACE `ts``1`; +CREATE TABLE `t``1` (a INT PRIMARY KEY , b INT); +INSERT INTO `t``1` VALUES (1,1); + +--connection server2 +--echo server2 + +--source include/start_group_replication.inc +--replace_result $CLONE_PLUGIN CLONE_PLUGIN +--eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN' +SET SESSION group_replication_consistency='BEFORE'; +SELECT * FROM `t``1`; +--source include/stop_group_replication.inc + +--let $rpl_connection_name = server2 +--source include/rpl_connection.inc + +--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` +--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` + +--let $plugin_list= $GROUP_REPLICATION +--source include/spawn_monitoring_process.inc + +--connection server1 +--echo server1 +INSERT INTO `t``1` VALUES (2,2); +INSERT INTO `t``1` VALUES (3,3); + +--connection server2 +--echo server2 + +--disable_query_log +--eval SET PERSIST group_replication_group_name= "$group_replication_group_name" +--eval SET PERSIST group_replication_local_address= "$_group_replication_local_address" +--eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds" +--enable_query_log + +SET GLOBAL group_replication_clone_threshold=1; +START GROUP_REPLICATION; + +--source include/wait_until_disconnected.inc +--let $rpl_server_number= 2 +--source include/rpl_reconnect.inc +--source include/start_group_replication.inc +--let $group_replication_member_state=ONLINE +--source include/gr_wait_for_member_state.inc + + +--connection server2 +--echo server2 +SELECT * FROM `t``1`; + +--let $rpl_connection_name= server2 +--source include/rpl_connection.inc +--source include/clean_monitoring_process.inc +UNINSTALL PLUGIN clone; +DROP DATABASE `te``st`; +DROP TABLESPACE `ts``1`; +DROP TABLE `t``1`; + +RESET PERSIST IF EXISTS group_replication_group_name; +RESET PERSIST IF EXISTS group_replication_local_address; +RESET PERSIST IF EXISTS group_replication_group_seeds; + + +set session sql_log_bin=0; +call mtr.add_suppression("Started with --core-file and --coredumper. --coredumper will take precedence."); +call mtr.add_suppression("Plugin group_replication reported: 'This member will start distributed recovery using clone."); +call mtr.add_suppression("Clone removing all user data for provisioning: Started"); +call mtr.add_suppression("Clone removing all user data for provisioning: Finished"); +set session sql_log_bin=1; + +--let $rpl_connection_name= server1 +--source include/rpl_connection.inc +UNINSTALL PLUGIN clone; +DROP DATABASE `te``st`; +DROP TABLESPACE `ts``1`; +DROP TABLE `t``1`; + +--source include/group_replication_end.inc diff --git a/storage/innobase/clone/clone0api.cc b/storage/innobase/clone/clone0api.cc index 2b3a4c2e330..6a4fdce3bd8 100644 --- a/storage/innobase/clone/clone0api.cc +++ b/storage/innobase/clone/clone0api.cc @@ -2060,16 +2060,26 @@ bool Fixup_data::execute_sql(THD *thd, const char *schema_name, if (tablespace_name != nullptr) { /* TABLESPACE operation */ - snprintf(sql_stmt, sizeof(sql_stmt), "DROP TABLESPACE `%s`", - tablespace_name); + String format_tablespace_name; + append_identifier(&format_tablespace_name, tablespace_name, + strlen(tablespace_name)); + snprintf(sql_stmt, sizeof(sql_stmt), "DROP TABLESPACE %s", + format_tablespace_name.c_ptr_safe()); } else if (table_name != nullptr) { /* TABLE operation */ - snprintf(sql_stmt, sizeof(sql_stmt), "%s TABLE `%s`.`%s`", sql_operation(), - schema_name, table_name); + String format_schema_name; + String format_table_name; + append_identifier(&format_schema_name, schema_name, strlen(schema_name)); + append_identifier(&format_table_name, table_name, strlen(table_name)); + snprintf(sql_stmt, sizeof(sql_stmt), "%s TABLE %s.%s", sql_operation(), + format_schema_name.c_ptr_safe(), format_table_name.c_ptr_safe()); } else { /* SCHEMA operation */ - snprintf(sql_stmt, sizeof(sql_stmt), "DROP SCHEMA `%s`", schema_name); + String format_schema_name; + append_identifier(&format_schema_name, schema_name, strlen(schema_name)); + snprintf(sql_stmt, sizeof(sql_stmt), "DROP SCHEMA %s", + format_schema_name.c_ptr_safe()); } auto saved_thread_type = thd->system_thread;