diff options
author | unknown <serg@serg.mylan> | 2005-04-12 17:15:54 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2005-04-12 17:15:54 +0200 |
commit | 859b3e16ac0af20950bb2e0ac4d1fc7c6fb96fe0 (patch) | |
tree | 73e0b22a9dedccda629cfc39b6956be783637c88 /sql/handler.cc | |
parent | 0ec06cabbd41ac5a5c13a7cb26074dc938e1b735 (diff) | |
download | mariadb-git-859b3e16ac0af20950bb2e0ac4d1fc7c6fb96fe0.tar.gz |
FLUSH TABLES WITH READ LOCK should block writes to binlog too
mysql-test/r/flush_block_commit.result:
FLUSH TABLES WITH READ LOCK should block writes to binlog too
it does not yet
mysql-test/t/flush_block_commit.test:
FLUSH TABLES WITH READ LOCK should block writes to binlog too
it does not yet
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 785070176cb..22a4575fe6e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -586,6 +586,11 @@ int ha_commit_trans(THD *thd, bool all) #ifdef USING_TRANSACTIONS if (trans->nht) { + if (is_real_trans && wait_if_global_read_lock(thd, 0, 0)) + { + ha_rollback_trans(thd, all); + DBUG_RETURN(1); + } DBUG_EXECUTE_IF("crash_commit_before", abort();); if (!trans->no_2pc && trans->nht > 1) { @@ -595,7 +600,7 @@ int ha_commit_trans(THD *thd, bool all) if ((err= (*(*ht)->prepare)(thd, all))) { my_error(ER_ERROR_DURING_COMMIT, MYF(0), err); - error=1; + error= 1; } statistic_increment(thd->status_var.ha_prepare_count,&LOCK_status); } @@ -604,20 +609,28 @@ int ha_commit_trans(THD *thd, bool all) (error= !(cookie= tc_log->log(thd, xid))))) { ha_rollback_trans(thd, all); - return 1; + error= 1; + goto end; } - DBUG_EXECUTE_IF("crash_commit_after_log", abort();); + DBUG_EXECUTE_IF("crash_commit_after_log", abort();); } error=ha_commit_one_phase(thd, all) ? cookie ? 2 : 1 : 0; DBUG_EXECUTE_IF("crash_commit_before_unlog", abort();); if (cookie) tc_log->unlog(cookie, xid); DBUG_EXECUTE_IF("crash_commit_after", abort();); +end: + if (is_real_trans) + start_waiting_global_read_lock(thd); } #endif /* USING_TRANSACTIONS */ DBUG_RETURN(error); } +/* + NOTE - this function does not care about global read lock. + A caller should. +*/ int ha_commit_one_phase(THD *thd, bool all) { int error=0; @@ -628,18 +641,6 @@ int ha_commit_one_phase(THD *thd, bool all) #ifdef USING_TRANSACTIONS if (trans->nht) { - bool need_start_waiters= 0; - if (is_real_trans) - { - if ((error= wait_if_global_read_lock(thd, 0, 0))) - { - my_error(ER_ERROR_DURING_COMMIT, MYF(0), error); - error= 1; - } - else - need_start_waiters= 1; - } - for (ht=trans->ht; *ht; ht++) { int err; @@ -664,8 +665,6 @@ int ha_commit_one_phase(THD *thd, bool all) thd->variables.tx_isolation=thd->session_tx_isolation; thd->transaction.cleanup(); } - if (need_start_waiters) - start_waiting_global_read_lock(thd); } #endif /* USING_TRANSACTIONS */ DBUG_RETURN(error); |