diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-04 17:52:04 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-04 17:52:04 +0300 |
commit | 537f8594a60a1e09d6da0933b55764e0f8abbf5c (patch) | |
tree | 628c68bccb01538df826045ba6f3aaa45c29b93a /storage/innobase/include/trx0trx.h | |
parent | 647d5b243020b799fd7112a801965f5780b86349 (diff) | |
parent | f605ce08b5c0e6ed6907d0639bcc5b5630e9b40a (diff) | |
download | mariadb-git-537f8594a60a1e09d6da0933b55764e0f8abbf5c.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/include/trx0trx.h')
-rw-r--r-- | storage/innobase/include/trx0trx.h | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index e537bf80fe2..3aa357ab2e4 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -211,16 +211,13 @@ trx_recover_for_mysql( /*==================*/ XID* xid_list, /*!< in/out: prepared transactions */ uint len); /*!< in: number of slots in xid_list */ -/*******************************************************************//** -This function is used to find one X/Open XA distributed transaction -which is in the prepared state -@return trx or NULL; on match, the trx->xid will be invalidated; -note that the trx may have been committed, unless the caller is -holding lock_sys.mutex */ -trx_t * -trx_get_trx_by_xid( -/*===============*/ - XID* xid); /*!< in: X/Open XA transaction identifier */ +/** Look up an X/Open distributed transaction in XA PREPARE state. +@param[in] xid X/Open XA transaction identifier +@return transaction on match (the trx_t::xid will be invalidated); +note that the trx may have been committed before the caller acquires +trx_t::mutex +@retval NULL if no match */ +trx_t* trx_get_trx_by_xid(const XID* xid); /**********************************************************************//** If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE. */ @@ -467,6 +464,9 @@ Check transaction state */ ut_ad(!(t)->read_view.is_open()); \ ut_ad((t)->lock.wait_thr == NULL); \ ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \ + ut_ad((t)->lock.table_locks.empty()); \ + ut_ad(!(t)->autoinc_locks \ + || ib_vector_is_empty((t)->autoinc_locks)); \ ut_ad((t)->dict_operation == TRX_DICT_OP_NONE); \ } while(0) @@ -701,8 +701,8 @@ so without holding any mutex. The following are exceptions to this: * trx_rollback_resurrected() may access resurrected (connectionless) transactions while the system is already processing new user -transactions. The trx_sys.mutex prevents a race condition between it -and lock_trx_release_locks() [invoked by trx_commit()]. +transactions. The trx_sys.mutex and trx->is_recovered prevent +a race condition between it and trx_commit(). * trx_print_low() may access transactions not associated with the current thread. The caller must be holding lock_sys.mutex. @@ -713,7 +713,7 @@ must not be modified without holding trx->mutex. * The locking code (in particular, lock_deadlock_recursive() and lock_rec_convert_impl_to_expl()) will access transactions associated to other connections. The locks of transactions are protected by -lock_sys.mutex and sometimes by trx->mutex. */ +lock_sys.mutex (insertions also by trx->mutex). */ /** Represents an instance of rollback segment along with its state variables.*/ struct trx_undo_ptr_t { @@ -837,26 +837,19 @@ public: ACTIVE->COMMITTED is possible when the transaction is in rw_trx_hash. - Transitions to COMMITTED are protected by both lock_sys.mutex - and trx->mutex. - - NOTE: Some of these state change constraints are an overkill, - currently only required for a consistent view for printing stats. - This unnecessarily adds a huge cost for the general case. */ - + Transitions to COMMITTED are protected by trx_t::mutex. */ trx_state_t state; + /** whether this is a recovered transaction that should be + rolled back by trx_rollback_or_clean_recovered(). + Protected by trx_t::mutex for transactions that are in trx_sys. */ + bool is_recovered; ReadView read_view; /*!< consistent read view used in the transaction, or NULL if not yet set */ trx_lock_t lock; /*!< Information about the transaction locks and state. Protected by - trx->mutex or lock_sys.mutex - or both */ - bool is_recovered; /*!< 0=normal transaction, - 1=recovered, must be rolled back, - protected by trx_sys.mutex when - trx is in rw_trx_hash */ - + lock_sys.mutex (insertions also + by trx_t::mutex). */ /* These fields are not protected by any mutex. */ const char* op_info; /*!< English text describing the @@ -1116,6 +1109,12 @@ public: return flush_observer; } + /** Transition to committed state, to release implicit locks. */ + inline void commit_state(); + + /** Release any explicit locks of a committing transaction. */ + inline void release_locks(); + bool is_referenced() { |