summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorAndrei Elkin <andrei.elkin@mariadb.com>2021-10-25 18:25:03 +0300
committerAndrei <andrei.elkin@mariadb.com>2021-11-05 19:33:28 +0200
commit561b6c7e513abc4ceba263252b519bf715ce80f4 (patch)
tree1a820c0a1abf2ef87bd681fe78f2d1297d92f5c8 /sql/sp_head.cc
parente571eaae9fb6587932f8d191380b7f289a5f40a0 (diff)
downloadmariadb-git-561b6c7e513abc4ceba263252b519bf715ce80f4.tar.gz
MDEV-26833 Missed statement rollback in case transaction drops or create temporary tablemariadb-10.2.41
When transaction creates or drops temporary tables and afterward its statement faces an error even the transactional table statement's cached ROW format events get involved into binlog and are visible after the transaction's commit. Fixed with proper analysis of whether the errored-out statement needs to be rolled back in binlog. For instance a fact of already cached CREATE or DROP for temporary tables by previous statements alone does not cause to retain the being errored-out statement events in the cache. Conversely, if the statement creates or drops a temporary table itself it can't be rolled back - this rule remains.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 6a6bdf8fe09..cb5348cd110 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -3040,8 +3040,13 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
It's reset further in the common code part.
It's merged with the saved parent's value at the exit of this func.
*/
- bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
+ bool parent_modified_non_trans_table=
+ thd->transaction.stmt.modified_non_trans_table;
+ unsigned int parent_unsafe_rollback_flags=
+ thd->transaction.stmt.m_unsafe_rollback_flags;
thd->transaction.stmt.modified_non_trans_table= FALSE;
+ thd->transaction.stmt.m_unsafe_rollback_flags= 0;
+
DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->Item_change_list::is_empty());
/*
@@ -3162,6 +3167,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
what is needed from the substatement gained
*/
thd->transaction.stmt.modified_non_trans_table |= parent_modified_non_trans_table;
+ thd->transaction.stmt.m_unsafe_rollback_flags |= parent_unsafe_rollback_flags;
TRANSACT_TRACKER(add_trx_state_from_thd(thd));