diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2017-05-29 11:35:36 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-07-03 11:16:13 +0300 |
commit | 228479a28ce7e4c91f96962159fccc8dc71b5a36 (patch) | |
tree | 6570d3af4066e7bc7c648c0881344d3ba06a75b6 /sql/handler.h | |
parent | da7604a2943f633df3b193e26ee20110bae9fa7a (diff) | |
download | mariadb-git-228479a28ce7e4c91f96962159fccc8dc71b5a36.tar.gz |
MDEV-8075: DROP TEMPORARY TABLE not marked as ddl, causing optimistic parallel replication to fail
CREATE/DROP TEMPORARY TABLE are not safe to optimistically replicate in
parallel with other transactions, so they need to be marked as "ddl" in the
binlog.
This was already done for stand-alone CREATE/DROP TEMPORARY. But temporary
tables can also be created and dropped inside a BEGIN...END transaction, and
such transactions were not marked as ddl. Nor was the DROP TEMPORARY TABLE
statement emitted implicitly when a client connection is closed.
So this patch adds such ddl mark for the missing cases.
The difference to Kristian's original patch is mainly a fix in
mysql_trans_commit_alter_copy_data() to remember the unsafe_rollback_flags
over the temporary commit.
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h index dad2b81b39c..1d4dded3971 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1470,16 +1470,30 @@ struct THD_TRANS static unsigned int const CREATED_TEMP_TABLE= 0x02; static unsigned int const DROPPED_TEMP_TABLE= 0x04; static unsigned int const DID_WAIT= 0x08; + static unsigned int const DID_DDL= 0x10; void mark_created_temp_table() { DBUG_PRINT("debug", ("mark_created_temp_table")); m_unsafe_rollback_flags|= CREATED_TEMP_TABLE; } + void mark_dropped_temp_table() + { + DBUG_PRINT("debug", ("mark_dropped_temp_table")); + m_unsafe_rollback_flags|= DROPPED_TEMP_TABLE; + } + bool has_created_dropped_temp_table() const { + return + (m_unsafe_rollback_flags & (CREATED_TEMP_TABLE|DROPPED_TEMP_TABLE)) != 0; + } void mark_trans_did_wait() { m_unsafe_rollback_flags|= DID_WAIT; } bool trans_did_wait() const { return (m_unsafe_rollback_flags & DID_WAIT) != 0; } + void mark_trans_did_ddl() { m_unsafe_rollback_flags|= DID_DDL; } + bool trans_did_ddl() const { + return (m_unsafe_rollback_flags & DID_DDL) != 0; + } }; |