MySQL 5.6.14 Source Code Document
|
#include "univ.i"
#include "trx0types.h"
#include "dict0types.h"
#include "lock0types.h"
#include "log0log.h"
#include "usr0types.h"
#include "que0types.h"
#include "mem0mem.h"
#include "read0types.h"
#include "trx0xa.h"
#include "ut0vec.h"
#include "fts0fts.h"
#include "trx0trx.ic"
Go to the source code of this file.
Classes | |
struct | trx_lock_t |
struct | trx_t |
struct | commit_node_t |
Macros | |
#define | trx_start_if_not_started_xa(t) trx_start_if_not_started_xa_low((t)) |
#define | trx_start_if_not_started(t) trx_start_if_not_started_low((t)) |
#define | trx_start_for_ddl(t, o) trx_start_for_ddl_low((t), (o)) |
#define | TRX_WEIGHT(t) ((t)->undo_no + UT_LIST_GET_LEN((t)->lock.trx_locks)) |
#define | TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */ |
#define | trx_lock_wait_timeout_get(trx) |
#define | trx_is_autocommit_non_locking(t) ((t)->auto_commit && (t)->will_lock == 0) |
#define | trx_is_ac_nl_ro(t) ((t)->read_only && trx_is_autocommit_non_locking((t))) |
#define | assert_trx_in_rw_list(t) |
#define | assert_trx_in_list(t) |
#define | assert_trx_nonlocking_or_in_list(trx) ((void)0) |
#define | TRX_MAGIC_N 91118598 |
#define | TRX_ISO_READ_UNCOMMITTED |
#define | TRX_ISO_READ_COMMITTED |
#define | TRX_ISO_REPEATABLE_READ |
#define | TRX_ISO_SERIALIZABLE |
#define | TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */ |
#define | TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */ |
#define | TRX_SIG_NO_SIGNAL 0 |
#define | TRX_SIG_TOTAL_ROLLBACK 1 |
#define | TRX_SIG_ROLLBACK_TO_SAVEPT 2 |
#define | TRX_SIG_COMMIT 3 |
#define | TRX_SIG_BREAK_EXECUTION 5 |
#define | TRX_SIG_SELF |
#define | TRX_SIG_OTHER_SESS |
#define | trx_mutex_own(t) mutex_own(&t->mutex) |
#define | trx_mutex_enter(t) |
#define | trx_mutex_exit(t) |
#define | btr_search_latch (*btr_search_latch_temp) |
Enumerations | |
enum | commit_node_state { COMMIT_NODE_SEND = 1, COMMIT_NODE_WAIT } |
Variables | |
sess_t * | trx_dummy_sess |
UNIV_INLINE ibool | warn_unused_result |
rw_lock_t * | btr_search_latch_temp |
The latch protecting the adaptive search system. |
#define assert_trx_in_list | ( | t | ) |
Assert that the transaction is either in trx_sys->ro_trx_list or trx_sys->rw_trx_list but not both and it cannot be an autocommit non-locking select
#define assert_trx_in_rw_list | ( | t | ) |
Assert that the transaction is in the trx_sys_t::rw_trx_list
#define assert_trx_nonlocking_or_in_list | ( | trx | ) | ((void)0) |
#define btr_search_latch (*btr_search_latch_temp) |
#define trx_is_ac_nl_ro | ( | t | ) | ((t)->read_only && trx_is_autocommit_non_locking((t))) |
#define trx_is_autocommit_non_locking | ( | t | ) | ((t)->auto_commit && (t)->will_lock == 0) |
#define TRX_ISO_READ_COMMITTED |
#define TRX_ISO_READ_UNCOMMITTED |
#define TRX_ISO_REPEATABLE_READ |
#define TRX_ISO_SERIALIZABLE |
#define trx_lock_wait_timeout_get | ( | trx | ) |
Transactions that aren't started by the MySQL server don't set the trx_t::mysql_thd field. For such transactions we set the lock wait timeout to 0 instead of the user configured value that comes from innodb_lock_wait_timeout via trx_t::mysql_thd.
trx | transaction |
#define trx_mutex_enter | ( | t | ) |
#define trx_mutex_exit | ( | t | ) |
#define trx_mutex_own | ( | t | ) | mutex_own(&t->mutex) |
#define TRX_SIG_OTHER_SESS |
#define TRX_SIG_SELF |
#define TRX_WEIGHT | ( | t | ) | ((t)->undo_no + UT_LIST_GET_LEN((t)->lock.trx_locks)) |
enum commit_node_state |
UNIV_INTERN trx_t* trx_allocate_for_background | ( | void | ) |
Creates a transaction object for background operations by the master thread.
Definition at line 163 of file trx0trx.cc.
UNIV_INTERN trx_t* trx_allocate_for_mysql | ( | void | ) |
Creates a transaction object for MySQL.
Definition at line 180 of file trx0trx.cc.
UNIV_INTERN read_view_t* trx_assign_read_view | ( | trx_t * | trx | ) |
Assigns a read view for a consistent read query. All the consistent reads within the same transaction will get the same read view, which is created when this function is first called for a new started transaction.
UNIV_INTERN void trx_assign_rseg | ( | trx_t * | trx | ) |
Assign a read-only transaction a rollback-segment, if it is attempting to write to a TEMPORARY table. A read-only transaction that needs to be assigned a RBS.
Assign a read-only transaction a rollback-segment, if it is attempting to write to a TEMPORARY table.
trx | A read-only transaction that needs to be assigned a RBS. |
Definition at line 780 of file trx0trx.cc.
UNIV_INTERN void trx_cleanup_at_db_startup | ( | trx_t * | trx | ) |
Cleans up a transaction at database startup. The cleanup is needed if the transaction already got to the middle of a commit when the database crashed, and we cannot roll it back. in: transaction
UNIV_INTERN void trx_commit | ( | trx_t * | trx | ) |
Commits a transaction.
trx | in/out: transaction |
UNIV_INTERN void trx_commit_complete_for_mysql | ( | trx_t * | trx | ) |
If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE.
trx | in/out: transaction |
Does the transaction commit for MySQL.
Commits a transaction and a mini-transaction.
trx | in/out: transaction |
mtr | in/out: mini-transaction (will be committed), or NULL if trx made no modifications |
UNIV_INTERN commit_node_t* trx_commit_node_create | ( | mem_heap_t * | heap | ) |
Creates a commit command node struct.
UNIV_INTERN void trx_commit_or_rollback_prepare | ( | trx_t * | trx | ) |
Prepares a transaction for commit/rollback. in/out: transaction
Performs an execution step for a commit type node in a query graph.
UNIV_INTERN void trx_free_for_background | ( | trx_t * | trx | ) |
Frees a transaction object of a background operation of the master thread. in, own: trx object
Frees a transaction object of a background operation of the master thread.
trx | in, own: trx object |
Definition at line 251 of file trx0trx.cc.
UNIV_INTERN void trx_free_for_mysql | ( | trx_t * | trx | ) |
Frees a transaction object for MySQL. in, own: trx object
Frees a transaction object for MySQL.
trx | in, own: trx object |
Definition at line 324 of file trx0trx.cc.
UNIV_INTERN void trx_free_prepared | ( | trx_t * | trx | ) |
At shutdown, frees a transaction object that is in the PREPARED state.
trx | in, own: trx object |
Definition at line 296 of file trx0trx.cc.
UNIV_INLINE enum trx_dict_op_t trx_get_dict_operation | ( | const trx_t * | trx | ) |
Determine if a transaction is a dictionary operation.
trx | in: transaction |
UNIV_INLINE const dict_index_t* trx_get_error_info | ( | const trx_t * | trx | ) |
Retrieves the error_info field from a trx.
UNIV_INLINE const char* trx_get_que_state_str | ( | const trx_t * | trx | ) |
Retrieves transaction's que state in a human readable string. The string should not be free()'d or modified.
This function is used to find one X/Open XA distributed transaction which is in the prepared state
UNIV_INTERN ibool trx_is_interrupted | ( | const trx_t * | trx | ) |
Determines if the currently running transaction has been interrupted.
Determines if the currently running transaction has been interrupted.
trx | in: transaction |
Definition at line 2635 of file ha_innodb.cc.
UNIV_INTERN ibool trx_is_strict | ( | trx_t * | trx | ) |
Determines if the currently running transaction is in strict mode.
Determines if the currently running transaction is in strict mode.
trx | in: transaction |
Definition at line 2647 of file ha_innodb.cc.
UNIV_INTERN void trx_lists_init_at_db_start | ( | void | ) |
Creates trx objects for transactions and initializes the trx list of trx_sys at database start. Rollback segment and undo log lists must already exist when this function is called, because the lists of transactions to be rolled back or cleaned up are built based on the undo log lists.
Definition at line 659 of file trx0trx.cc.
UNIV_INTERN void trx_mark_sql_stat_end | ( | trx_t * | trx | ) |
Marks the latest SQL statement ended. in: trx handle
UNIV_INTERN void trx_prepare_for_mysql | ( | trx_t * | trx | ) |
Does the transaction prepare for MySQL. in/out: trx handle
UNIV_INTERN void trx_print | ( | FILE * | f, |
const trx_t * | trx, | ||
ulint | max_query_len | ||
) |
Prints info about a transaction. Acquires and releases lock_sys->mutex and trx_sys->mutex.
f | in: output stream |
trx | in: transaction |
max_query_len | in: max query length to print, or 0 to use the default max length |
UNIV_INTERN void trx_print_latched | ( | FILE * | f, |
const trx_t * | trx, | ||
ulint | max_query_len | ||
) |
Prints info about a transaction. The caller must hold lock_sys->mutex and trx_sys->mutex. When possible, use trx_print() instead.
f | in: output stream |
trx | in: transaction |
max_query_len | in: max query length to print, or 0 to use the default max length |
UNIV_INTERN void trx_print_low | ( | FILE * | f, |
const trx_t * | trx, | ||
ulint | max_query_len, | ||
ulint | n_rec_locks, | ||
ulint | n_trx_locks, | ||
ulint | heap_size | ||
) |
Prints info about a transaction. Caller must hold trx_sys->mutex.
f | in: output stream |
trx | in: transaction |
max_query_len | in: max query length to print, or 0 to use the default max length |
n_rec_locks | in: lock_number_of_rows_locked(&trx->lock) |
n_trx_locks | in: length of trx->lock.trx_locks |
heap_size | in: mem_heap_get_size(trx->lock.lock_heap) |
UNIV_INTERN int trx_recover_for_mysql | ( | XID * | xid_list, |
ulint | len | ||
) |
This function is used to find number of prepared transactions and their transaction objects for a recovery.
xid_list | in/out: prepared transactions |
UNIV_INLINE void trx_search_latch_release_if_reserved | ( | trx_t * | trx | ) |
Releases the search latch if trx has reserved it. in: transaction
UNIV_INTERN void trx_set_detailed_error | ( | trx_t * | trx, |
const char * | msg | ||
) |
Set detailed error message for the transaction. in: detailed error message
Set detailed error message for the transaction.
trx | in: transaction struct |
msg | in: detailed error message |
Definition at line 70 of file trx0trx.cc.
UNIV_INTERN void trx_set_detailed_error_from_file | ( | trx_t * | trx, |
FILE * | file | ||
) |
Set detailed error message for the transaction from a file. Note that the file is rewinded before reading from it. in: file to read message from
Set detailed error message for the transaction from a file. Note that the file is rewinded before reading from it.
trx | in: transaction struct |
file | in: file to read message from |
Definition at line 83 of file trx0trx.cc.
UNIV_INLINE void trx_set_dict_operation | ( | trx_t * | trx, |
enum trx_dict_op_t | op | ||
) |
Flag a transaction a dictionary operation. in: operation, not TRX_DICT_OP_NONE
trx | in/out: transaction |
UNIV_INTERN void trx_start_for_ddl_low | ( | trx_t * | trx, |
trx_dict_op_t | op | ||
) |
Starts the transaction for a DDL operation.
trx | in/out: transaction |
op | in: dictionary operation type |
UNIV_INTERN void trx_start_if_not_started_low | ( | trx_t * | trx | ) |
Starts the transaction if it is not yet started. in: transaction
UNIV_INTERN void trx_start_if_not_started_xa_low | ( | trx_t * | trx | ) |
Starts the transaction if it is not yet started. in: transaction
UNIV_INLINE ibool trx_state_eq | ( | const trx_t * | trx, |
trx_state_t | state | ||
) |
Determines if a transaction is in the given state. The caller must hold trx_sys->mutex, or it must be the thread that is serving a running transaction. A running transaction must be in trx_sys->ro_trx_list or trx_sys->rw_trx_list unless it is a non-locking autocommit read only transaction, which is only in trx_sys->mysql_trx_list.
trx | in: transaction |
state | in: state; if state != TRX_STATE_NOT_STARTED asserts that trx->state != TRX_STATE_NOT_STARTED |
Compares the "weight" (or size) of two transactions. Transactions that have edited non-transactional tables are considered heavier than ones that have not.
a | in: the first transaction to be compared |
rw_lock_t* btr_search_latch_temp |
The latch protecting the adaptive search system.
This latch protects the (1) hash index; (2) columns of a record to which we have a pointer in the hash index;
but does NOT protect:
(3) next record offset field in a record; (4) next or previous records on the same page.
Bear in mind (3) and (4) when using the hash index.
The latch protecting the adaptive search system: this latch protects the
(1) positions of records on those pages where a hash index has been built. NOTE: It does not protect values of non-ordering fields within a record from being updated in-place! We can use fact (1) to perform unique searches to indexes.
Definition at line 73 of file btr0sea.cc.
sess_t* trx_dummy_sess |
Dummy session used currently in MySQL interface
Definition at line 57 of file trx0trx.cc.