diff options
author | unknown <serg@serg.mylan> | 2004-08-20 21:56:29 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-08-20 21:56:29 +0200 |
commit | adf4e7a82284e5cbacff5c38e02064e73533b997 (patch) | |
tree | d3bc4a6cf5270e88d92f8b8cc86572fd34a9405c /sql/handler.cc | |
parent | 91df160829a7e7699f2665716d860da069cd0f95 (diff) | |
parent | 4f0e2da3169968b826f0b180dfe5de0ca99b40b9 (diff) | |
download | mariadb-git-adf4e7a82284e5cbacff5c38e02064e73533b997.tar.gz |
merged
sql/lock.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_db.cc:
Auto merged
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 30d568aff4b..39a6296a525 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -477,26 +477,40 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) if (opt_using_transactions) { bool operation_done= 0; - bool transaction_commited= 0; + bool operation_done= 0, need_start_waiters= 0; - /* Update the binary log if we have cached some queries */ - if (trans == &thd->transaction.all && mysql_bin_log.is_open() && + /* If transaction has done some updates to tables */ + if (trans == &thd->transaction.all && my_b_tell(&thd->transaction.trans_log)) { - mysql_bin_log.write(thd, &thd->transaction.trans_log, 1); - statistic_increment(binlog_cache_use, &LOCK_status); - if (thd->transaction.trans_log.disk_writes != 0) + if (error= wait_if_global_read_lock(thd, 0, 0)) { - /* - We have to do this after addition of trans_log to main binlog since - this operation can cause flushing of end of trans_log to disk. + /* + Note that ROLLBACK [TO SAVEPOINT] does not have this test; it's + because ROLLBACK never updates data, so needn't wait on the lock. */ - statistic_increment(binlog_cache_disk_use, &LOCK_status); - thd->transaction.trans_log.disk_writes= 0; + my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); + error= 1; + } + else + need_start_waiters= 1; + if (mysql_bin_log.is_open()) + { + mysql_bin_log.write(thd, &thd->transaction.trans_log, 1); + statistic_increment(binlog_cache_use, &LOCK_status); + if (thd->transaction.trans_log.disk_writes != 0) + { + /* + We have to do this after addition of trans_log to main binlog since + this operation can cause flushing of end of trans_log to disk. + */ + statistic_increment(binlog_cache_disk_use, &LOCK_status); + thd->transaction.trans_log.disk_writes= 0; + } + 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; } - 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_NDBCLUSTER_DB if (trans->ndb_tid) @@ -551,6 +565,8 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans) statistic_increment(ha_commit_count,&LOCK_status); thd->transaction.cleanup(); } + if (need_start_waiters) + start_waiting_global_read_lock(thd); } #endif // using transactions DBUG_RETURN(error); |