diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2010-04-20 10:10:43 +0100 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2010-04-20 10:10:43 +0100 |
commit | 9ba731c29966831c0359cc05f442969870b34bef (patch) | |
tree | e7101329f216f6841cc40995b7a36f834d208c2a /sql/log.h | |
parent | 4ca8066fa93bf67fb69cfe17689262a50263e4ca (diff) | |
download | mariadb-git-9ba731c29966831c0359cc05f442969870b34bef.tar.gz |
BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
transaction
BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW
Before the WL#2687 and BUG#46364, every non-transactional change that happened
after a transactional change was written to trx-cache and flushed upon
committing the transaction. WL#2687 and BUG#46364 changed this behavior and
non-transactional changes are now written to the binary log upon committing
the statement.
A binary log event is identified as transactional or non-transactional through
a flag in the Log_event which is set taking into account the underlie storage
engine on what it is stems from. In the current bug, this flag was not being
set properly when the DROP TEMPORARY TABLE was executed.
However, while fixing this bug we figured out that changes to temporary tables
should be always written to the trx-cache if there is an on-going transaction.
Otherwise, binlog events in the reversed order would be produced.
Regarding concurrency, keeping changes to temporary tables in the trx-cache is
also safe as temporary tables are only visible to the owner connection.
In this patch, we classify the following statements as unsafe:
1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
3 - CREATE TEMPORARY TABLE t_myisam_temp SELECT * FROM t_myisam
On the other hand, the following statements are classified as safe:
1 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
2 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
The patch also guarantees that transactions that have a DROP TEMPORARY are
always written to the binary log regardless of the mode and the outcome:
commit or rollback. In particular, the DROP TEMPORARY is extended with the
IF EXISTS clause when the current statement logging format is set to row.
Finally, the patch allows to switch from STATEMENT to MIXED/ROW when there
are temporary tables but the contrary is not possible.
Diffstat (limited to 'sql/log.h')
-rw-r--r-- | sql/log.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/log.h b/sql/log.h index 71c27f50f78..12e02969485 100644 --- a/sql/log.h +++ b/sql/log.h @@ -26,6 +26,9 @@ class Format_description_log_event; bool trans_has_updated_trans_table(const THD* thd); bool stmt_has_updated_trans_table(const THD *thd); bool use_trans_cache(const THD* thd, bool is_transactional); +bool ending_trans(THD* thd, const bool all); +bool trans_has_updated_non_trans_table(const THD* thd); +bool stmt_has_updated_non_trans_table(const THD* thd); /* Transaction Coordinator log - a base abstract class |