diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 8447797442c..2129162c427 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -271,7 +271,8 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) #ifdef USING_TRANSACTIONS if (opt_using_transactions) { - bool operation_done=0; + bool operation_done= 0; + bool transaction_commited= 0; /* Update the binary log if we have cached some queries */ if (trans == &thd->transaction.all && mysql_bin_log.is_open() && my_b_tell(&thd->transaction.trans_log)) @@ -289,6 +290,8 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; } + else + transaction_commited= 1; trans->bdb_tid=0; } #endif @@ -302,12 +305,12 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) } trans->innodb_active_trans=0; if (trans == &thd->transaction.all) - { - query_cache.invalidate(Query_cache_table::INNODB); - operation_done=1; - } + operation_done= transaction_commited= 1; + } #endif + if (transaction_commited) + query_cache.invalidate(thd->transaction.changed_tables); if (error && trans == &thd->transaction.all && mysql_bin_log.is_open()) sql_print_error("Error: Got error during commit; Binlog is not up to date!"); thd->tx_isolation=thd->session_tx_isolation; |