From 80da35a3267724804c6ced03a27e00d9551b3e01 Mon Sep 17 00:00:00 2001 From: Andrei Date: Sun, 26 Dec 2021 18:13:49 +0200 Subject: MDEV-27365 CREATE-or-REPLACE SEQUENCE is binlogged without DDL flag CREATE-OR-REPLACE SEQUENCE is not logged with Gtid event DDL flag which affects its slave parallel execution. Unlike other DDL:s it can occur in concurrent execution with following transactions which can lead to various errors, including asserts like (mdl_request->type != MDL_INTENTION_EXCLUSIVE && mdl_request->type != MDL_EXCLUSIVE) || !(get_thd()->rgi_slave && get_thd()->rgi_slave->is_parallel_exec && lock->check_if_conflicting_replication_locks(this) in MDL_context::acquire_lock. Fixed to wrap internal statement level commit with save- and-restore of TRANS_THD::m_unsafe_rollback_flags. --- sql/sql_sequence.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sql/sql_sequence.cc') diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 11125c0a619..e5fea586d06 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -365,9 +365,14 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list) seq->reserved_until= seq->start; error= seq->write_initial_sequence(table); - - if (trans_commit_stmt(thd)) - error= 1; + { + uint save_unsafe_rollback_flags= + thd->transaction.stmt.m_unsafe_rollback_flags; + if (trans_commit_stmt(thd)) + error= 1; + thd->transaction.stmt.m_unsafe_rollback_flags= + save_unsafe_rollback_flags; + } if (trans_commit_implicit(thd)) error= 1; -- cgit v1.2.1 From c6a890a795595a2049a42a7c7039e03e674b13a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 4 Jan 2022 14:18:34 +0200 Subject: MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster Galera replication of new DDL-case was missing --- sql/sql_sequence.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sql/sql_sequence.cc') diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 83091cd67da..8d1a67eab85 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -908,6 +908,13 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) if (check_grant(thd, ALTER_ACL, first_table, FALSE, 1, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ +#ifdef WITH_WSREP + if (WSREP_ON && WSREP(thd) && + wsrep_to_isolation_begin(thd, first_table->db.str, + first_table->table_name.str, + first_table)) + DBUG_RETURN(TRUE); +#endif /* WITH_WSREP */ if (if_exists()) thd->push_internal_handler(&no_such_table_handler); error= open_and_lock_tables(thd, first_table, FALSE, 0); -- cgit v1.2.1