3445 Marko Mäkelä 2011-01-20
Clarify the protection rules of trx_lock_t::wait_thr.
modified:
storage/innobase/include/trx0trx.h
3444 Marko Mäkelä 2011-01-20
Non-functional change: Remove a goto.
modified:
storage/innobase/trx/trx0trx.c
3443 Marko Mäkelä 2011-01-20
WL#5458 clean-up: Clarify the latching rules for trx->state changes.
This rules is already documented in trx0trx.h and possibly some
other places in the code:
When a transaction is (or may be) in the trx->mysql_trx_list or
trx_sys->trx_list, changing its state to or from TRX_STATE_NOT_STARTED
is only allowed while holding trx_sys->lock in exclusive mode.
trx_start_low(): Change the state from TRX_STATE_NOT_STARTED to
TRX_STATE_ACTIVE while holding trx_sys->lock.
trx_commit(): Change the state to TRX_STATE_NOT_STARTED while holding
trx_sys->lock. Remove the transaction from trx_sys->trx_list before
removing the read view and flushing the redo log.
trx_cleanup_at_db_startup(): Change the state to TRX_STATE_NOT_STARTED
while holding trx_sys->lock.
lock_print_info_all_transactions(), read_view_open_now_low(): Update
comments about reads of trx->state that are no longer dirty.
rb://573 approved by Sunny Bains
modified:
storage/innobase/lock/lock0lock.c
storage/innobase/read/read0read.c
storage/innobase/trx/trx0trx.c
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h revid:marko.makela@strippedguftugt
+++ b/storage/innobase/include/trx0trx.h revid:marko.makela@stripped
@@ -431,9 +431,13 @@ struct trx_lock_struct {
time_t wait_started; /*!< lock wait started at this time,
protected only by lock_sys->mutex */
- que_thr_t* wait_thr; /*!< query thread beloging to this
+ que_thr_t* wait_thr; /*!< query thread belonging to this
trx that is in QUE_THR_LOCK_WAIT
- state */
+ state. For threads suspended in a
+ lock wait, this is protected by
+ lock_sys->mutex. Otherwise, this may
+ only be modified by the thread that is
+ serving the running transaction. */
mem_heap_t* lock_heap; /*!< memory heap for trx_locks;
protected by lock_sys->mutex */
=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c revid:marko.makela@stripped
+++ b/storage/innobase/trx/trx0trx.c revid:marko.makela@strippedm-20110120095049-4xvjivqcldghi77b
@@ -1066,23 +1066,17 @@ trx_commit_for_mysql(
/* fall through */
case TRX_STATE_ACTIVE:
case TRX_STATE_PREPARED:
- goto state_ok;
+ trx->op_info = "committing";
+ trx_commit(trx);
+ MONITOR_INC(MONITOR_TRX_COMMIT);
+ MONITOR_DEC(MONITOR_TRX_ACTIVE);
+ trx->op_info = "";
+ return(DB_SUCCESS);
case TRX_STATE_COMMITTED_IN_MEMORY:
break;
}
ut_error;
-state_ok:
- trx->op_info = "committing";
-
- trx_commit(trx);
-
- MONITOR_INC(MONITOR_TRX_COMMIT);
-
- MONITOR_DEC(MONITOR_TRX_ACTIVE);
-
- trx->op_info = "";
-
- return(DB_SUCCESS);
+ return(DB_CORRUPTION);
}
/**********************************************************************//**
Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20110120095049-4xvjivqcldghi77b.bundle
| Thread |
|---|
| • bzr push into mysql-trunk-innodb branch (marko.makela:3443 to 3445) | marko.makela | 20 Jan |