summaryrefslogtreecommitdiff
path: root/sql/handler.h
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/handler.h
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/handler.h')
-rw-r--r--sql/handler.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h
index 542b91c570d..02a4a76c6c1 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1477,6 +1477,9 @@ struct THD_TRANS
/*
Define the type of statemens which cannot be rolled back safely.
Each type occupies one bit in m_unsafe_rollback_flags.
+ MODIFIED_NON_TRANS_TABLE is limited to mark only the temporary
+ non-transactional table *when* it's cached along with the transactional
+ events; the regular table is covered by the "namesake" bool var.
*/
static unsigned int const MODIFIED_NON_TRANS_TABLE= 0x01;
static unsigned int const CREATED_TEMP_TABLE= 0x02;
@@ -1485,6 +1488,14 @@ struct THD_TRANS
static unsigned int const DID_DDL= 0x10;
static unsigned int const EXECUTED_TABLE_ADMIN_CMD= 0x20;
+ void mark_modified_non_trans_temp_table()
+ {
+ m_unsafe_rollback_flags|= MODIFIED_NON_TRANS_TABLE;
+ }
+ bool has_modified_non_trans_temp_table() const
+ {
+ return (m_unsafe_rollback_flags & MODIFIED_NON_TRANS_TABLE) != 0;
+ }
void mark_executed_table_admin_cmd()
{
DBUG_PRINT("debug", ("mark_executed_table_admin_cmd"));