diff options
author | monty@donna.mysql.com <> | 2000-12-07 14:08:48 +0200 |
---|---|---|
committer | monty@donna.mysql.com <> | 2000-12-07 14:08:48 +0200 |
commit | 87d9388e52a128427481064e21373f8460d6b24f (patch) | |
tree | 8a5c9d678d477bb2c3fa95057c9299dcf9560aab /sql/handler.cc | |
parent | a5c75df390e9b67454bd0a04e75583057e9579f7 (diff) | |
download | mariadb-git-87d9388e52a128427481064e21373f8460d6b24f.tar.gz |
Only write full transactions to binary log
A lot of new functions for BDB tables
Fix for DROP DATABASE on windows
Default server_id variables
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 83ab85ebbbd..7c6a3e32ff2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -191,8 +191,7 @@ int ha_autocommit_or_rollback(THD *thd, int error) { DBUG_ENTER("ha_autocommit_or_rollback"); #ifdef USING_TRANSACTIONS - if (!(thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN)) && - !thd->locked_tables) + if (!(thd->options & (OPTION_NOT_AUTO_COMMIT | OPTION_BEGIN))) { if (!error) { @@ -211,6 +210,16 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) { int error=0; DBUG_ENTER("ha_commit"); +#ifdef USING_TRANSACTIONS + /* 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)) + { + mysql_bin_log.write(&thd->transaction.trans_log); + reinit_io_cache(&thd->transaction.trans_log, + WRITE_CACHE, (my_off_t) 0, 0, 1); + thd->transaction.trans_log.end_of_file= max_binlog_cache_size; + } #ifdef HAVE_BERKELEY_DB if (trans->bdb_tid) { @@ -224,7 +233,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) #endif #ifdef HAVE_INNOBASE_DB { - if ((error=innobase_commit(thd,trans->innobase_tid)) + if ((error=innobase_commit(thd,trans->innobase_tid))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); error=1; @@ -232,6 +241,9 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) trans->innobase_tid=0; } #endif + 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!"); +#endif DBUG_RETURN(error); } @@ -261,6 +273,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) trans->innobase_tid=0; } #endif +#ifdef USING_TRANSACTIONS + if (trans == &thd->transaction.all) + reinit_io_cache(&thd->transaction.trans_log, + WRITE_CACHE, (my_off_t) 0, 0, 1); + thd->transaction.trans_log.end_of_file= max_binlog_cache_size; +#endif DBUG_RETURN(error); } |