summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorsjaakola <seppo.jaakola@iki.fi>2020-11-04 13:42:18 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2020-11-11 17:46:50 +0200
commitad432ef4c0b81cf796f9b1f66848a3cde6becf77 (patch)
tree0bf96ebee710d3de2dfe105de7fad6a92c313e95 /include
parent99a9774754ea8c4e309589a2dbc7847e16e1fbde (diff)
downloadmariadb-git-ad432ef4c0b81cf796f9b1f66848a3cde6becf77.tar.gz
MDEV-24119 MDL BF-BF Conflict caused by TRUNCATE TABLE
This PR fixes same issue as MDEV-21577 for TRUNCATE TABLE. MDEV-21577 fixed TOI replication for OPTIMIZE, REPAIR and ALTER TABLE operating on FK child table. It was later found out that also TRUNCATE has similar problem and needs a fix. The actual fix is to do FK parent table lookup before TRUNCATE TOI isolation and append found FK parent table names in certification key list for the write set. PR contains also new test scenario in galera_ddl_fk_conflict test where FK child has two FK parent tables and there are two DML transactions operating on both parent tables. For development convenience, new TO isolation macro was added: WSREP_TO_ISOLATION_BEGIN_IF and WSREP_TO_ISOLATION_BEGIN_ALTER macro was changed to skip the goto statement. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
Diffstat (limited to 'include')
-rw-r--r--include/wsrep.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/wsrep.h b/include/wsrep.h
index 65cceba1065..5272b687732 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -23,15 +23,17 @@
#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
#define WSREP_MYSQL_DB (char *)"mysql"
-#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
+#define WSREP_TO_ISOLATION_BEGIN_IF(db_, table_, table_list_) \
+ if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_))
+
+#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
goto wsrep_error_label;
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_, fk_tables_) \
if (WSREP(thd) && wsrep_thd_is_local(thd) && \
wsrep_to_isolation_begin(thd, db_, table_, \
- table_list_, alter_info_, fk_tables_)) \
- goto wsrep_error_label;
+ table_list_, alter_info_, fk_tables_))
#define WSREP_TO_ISOLATION_END \
if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \
@@ -48,7 +50,7 @@
#define WSREP_TO_ISOLATION_BEGIN_FK_TABLES(db_, table_, table_list_, fk_tables) \
if (WSREP(thd) && !thd->lex->no_write_to_binlog \
- && wsrep_to_isolation_begin(thd, db_, table_, table_list_, NULL, fk_tables)) goto wsrep_error_label;
+ && wsrep_to_isolation_begin(thd, db_, table_, table_list_, NULL, fk_tables))
#define WSREP_DEBUG(...) \
if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)