From c710c450e3a5654244fffaabcb4ba5af2dd24dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 28 Aug 2020 16:40:12 +0300 Subject: MDEV-21578 : CREATE OR REPLACE TRIGGER in Galera cluster not replicating While doing TOI buffer OR REPLACE option was not added to replicated string. --- sql/wsrep_mysqld.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sql/wsrep_mysqld.cc') diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index f95ef168a23..d392d1c2a61 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2924,7 +2924,12 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len) definer_host.length= 0; } - stmt_query.append(STRING_WITH_LEN("CREATE ")); + const LEX_STRING command[3]= + {{ C_STRING_WITH_LEN("CREATE ") }, + { C_STRING_WITH_LEN("ALTER ") }, + { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; + stmt_query.append(command[thd->lex->create_view_mode].str, + command[thd->lex->create_view_mode].length); append_definer(thd, &stmt_query, &definer_user, &definer_host); -- cgit v1.2.1 From 33ae1616e01b564d03c507769564d37c582783cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 3 Sep 2020 14:10:42 +0300 Subject: MDEV-21578 : CREATE OR REPLACE TRIGGER in Galera cluster not replicating In 10.3 OR REPLACE trigger option is part of create_info. --- sql/wsrep_mysqld.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sql/wsrep_mysqld.cc') diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 20f2cd99edd..de234770788 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2900,11 +2900,14 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len) definer_host.length= 0; } - const LEX_CSTRING command[3]= + const LEX_CSTRING command[2]= {{ C_STRING_WITH_LEN("CREATE ") }, - { C_STRING_WITH_LEN("ALTER ") }, { C_STRING_WITH_LEN("CREATE OR REPLACE ") }}; - stmt_query.append(command[thd->lex->create_view->mode]); + + if (thd->lex->create_info.or_replace()) + stmt_query.append(command[1]); + else + stmt_query.append(command[0]); append_definer(thd, &stmt_query, &definer_user, &definer_host); -- cgit v1.2.1