diff options
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/sql/log.cc b/sql/log.cc index 95cb60ea829..e67684e1825 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -263,8 +263,7 @@ class binlog_cache_data public: binlog_cache_data(): m_pending(0), status(0), before_stmt_pos(MY_OFF_T_UNDEF), - incident(FALSE), changes_to_non_trans_temp_table_flag(FALSE), - saved_max_binlog_cache_size(0), ptr_binlog_cache_use(0), + incident(FALSE), saved_max_binlog_cache_size(0), ptr_binlog_cache_use(0), ptr_binlog_cache_disk_use(0) { } @@ -312,16 +311,6 @@ public: return(incident); } - void set_changes_to_non_trans_temp_table() - { - changes_to_non_trans_temp_table_flag= TRUE; - } - - bool changes_to_non_trans_temp_table() - { - return (changes_to_non_trans_temp_table_flag); - } - void reset() { bool cache_was_empty= empty(); @@ -333,7 +322,6 @@ public: if (truncate_file) my_chsize(cache_log.file, 0, 0, MYF(MY_WME)); - changes_to_non_trans_temp_table_flag= FALSE; status= 0; incident= FALSE; before_stmt_pos= MY_OFF_T_UNDEF; @@ -432,12 +420,6 @@ private: */ bool incident; - /* - This flag indicates if the cache has changes to temporary tables. - @TODO This a temporary fix and should be removed after BUG#54562. - */ - bool changes_to_non_trans_temp_table_flag; - /** This function computes binlog cache and disk usage. */ @@ -1977,13 +1959,12 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) */ static bool trans_cannot_safely_rollback(THD *thd, bool all) { - binlog_cache_mngr *const cache_mngr= - (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); + DBUG_ASSERT(ending_trans(thd, all)); return ((thd->variables.option_bits & OPTION_KEEP_LOG) || (trans_has_updated_non_trans_table(thd) && thd->wsrep_binlog_format() == BINLOG_FORMAT_STMT) || - (cache_mngr->trx_cache.changes_to_non_trans_temp_table() && + (thd->transaction.all.has_modified_non_trans_temp_table() && thd->wsrep_binlog_format() == BINLOG_FORMAT_MIXED) || (trans_has_updated_non_trans_table(thd) && ending_single_stmt_trans(thd,all) && @@ -2134,17 +2115,19 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) /* Truncate the cache if: . aborting a single or multi-statement transaction or; - . the OPTION_KEEP_LOG is not active and; + . the current statement created or dropped a temporary table + while having actual STATEMENT format; . the format is not STMT or no non-trans table was updated and; . the format is not MIXED or no temporary non-trans table was updated. */ else if (ending_trans(thd, all) || - (!(thd->variables.option_bits & OPTION_KEEP_LOG) && + (!(thd->transaction.stmt.has_created_dropped_temp_table() && + !thd->is_current_stmt_binlog_format_row()) && (!stmt_has_updated_non_trans_table(thd) || thd->wsrep_binlog_format() != BINLOG_FORMAT_STMT) && - (!cache_mngr->trx_cache.changes_to_non_trans_temp_table() || + (!thd->transaction.stmt.has_modified_non_trans_temp_table() || thd->wsrep_binlog_format() != BINLOG_FORMAT_MIXED))) error= binlog_truncate_trx_cache(thd, cache_mngr, all); } @@ -6340,9 +6323,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate) cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache); file= &cache_data->cache_log; - if (thd->lex->stmt_accessed_non_trans_temp_table()) - cache_data->set_changes_to_non_trans_temp_table(); - + if (thd->lex->stmt_accessed_non_trans_temp_table() && is_trans_cache) + thd->transaction.stmt.mark_modified_non_trans_temp_table(); thd->binlog_start_trans_and_stmt(); } DBUG_PRINT("info",("event type: %d",event_info->get_type_code())); |