From 49791cbc6f76c4f4c1bb436dbe26cec6177ee279 Mon Sep 17 00:00:00 2001 From: sjaakola Date: Wed, 15 Dec 2021 22:29:32 +0200 Subject: 10.4-MDEV-27275 CREATE TABLE with FK not safe for PA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit contains a fix, where the replication write set for a CREATE TABLE will contain, as certification keys, table names for all FK references. With this, all DML for the FK parent tables will conflict with the CREATE TABLE statement. There is also new test galera.MDEV-27276 to verify the fix. Reviewed-by: Jan Lindström --- sql/sql_table.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sql/sql_table.cc') diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 4409360cd8f..9a51ce49248 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11624,7 +11624,14 @@ bool Sql_cmd_create_table_like::execute(THD *thd) (!thd->is_current_stmt_binlog_format_row() || !create_info.tmp_table())) { - WSREP_TO_ISOLATION_BEGIN(create_table->db.str, create_table->table_name.str, NULL); +#ifdef WITH_WSREP + WSREP_TO_ISOLATION_BEGIN_ALTER(create_table->db.str, create_table->table_name.str, + first_table, &alter_info, NULL) + { + WSREP_WARN("CREATE TABLE isolation failure"); + DBUG_RETURN(true); + } +#endif /* WITH_WSREP */ } /* Regular CREATE TABLE */ res= mysql_create_table(thd, create_table, &create_info, &alter_info); @@ -11646,9 +11653,4 @@ bool Sql_cmd_create_table_like::execute(THD *thd) end_with_restore_list: DBUG_RETURN(res); - -#ifdef WITH_WSREP -wsrep_error_label: - DBUG_RETURN(true); -#endif } -- cgit v1.2.1