InnoDB Plugin
1.0
|
#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.
Data Structures | |
struct | trx_lock_t |
struct | trx_t |
struct | commit_node_t |
Macros | |
#define | trx_start_if_not_started_xa(t) |
#define | trx_start_if_not_started(t) |
#define | trx_start_for_ddl(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(t) |
#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 } |
Functions | |
UNIV_INLINE void | trx_search_latch_release_if_reserved (trx_t *trx) |
UNIV_INTERN void | trx_set_detailed_error (trx_t *trx, const char *msg) |
UNIV_INTERN void | trx_set_detailed_error_from_file (trx_t *trx, FILE *file) |
UNIV_INLINE const dict_index_t * | trx_get_error_info (const trx_t *trx) |
UNIV_INTERN trx_t * | trx_allocate_for_mysql (void) |
UNIV_INTERN trx_t * | trx_allocate_for_background (void) |
UNIV_INTERN void | trx_free_for_background (trx_t *trx) |
UNIV_INTERN void | trx_free_prepared (trx_t *trx) UNIV_COLD) |
UNIV_INTERN void | trx_free_for_mysql (trx_t *trx) |
UNIV_INTERN void | trx_lists_init_at_db_start (void) |
UNIV_INTERN void | trx_start_if_not_started_xa_low (trx_t *trx) |
UNIV_INTERN void | trx_start_if_not_started_low (trx_t *trx) |
UNIV_INTERN void | trx_start_for_ddl_low (trx_t *trx, trx_dict_op_t op)) |
UNIV_INTERN void | trx_commit (trx_t *trx)) |
UNIV_INTERN void | trx_commit_low (trx_t *trx, mtr_t *mtr))) |
UNIV_INTERN void | trx_cleanup_at_db_startup (trx_t *trx) |
UNIV_INTERN dberr_t | trx_commit_for_mysql (trx_t *trx) |
UNIV_INTERN void | trx_prepare_for_mysql (trx_t *trx) |
UNIV_INTERN int | trx_recover_for_mysql (XID *xid_list, ulint len) |
UNIV_INTERN trx_t * | trx_get_trx_by_xid (const XID *xid) |
UNIV_INTERN void | trx_commit_complete_for_mysql (trx_t *trx)) |
UNIV_INTERN void | trx_mark_sql_stat_end (trx_t *trx) |
UNIV_INTERN read_view_t * | trx_assign_read_view (trx_t *trx) |
UNIV_INTERN void | trx_commit_or_rollback_prepare (trx_t *trx) |
UNIV_INTERN commit_node_t * | trx_commit_node_create (mem_heap_t *heap) |
UNIV_INTERN que_thr_t * | trx_commit_step (que_thr_t *thr) |
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)) |
UNIV_INTERN void | trx_print_latched (FILE *f, const trx_t *trx, ulint max_query_len)) |
UNIV_INTERN void | trx_print (FILE *f, const trx_t *trx, ulint max_query_len)) |
UNIV_INLINE enum trx_dict_op_t | trx_get_dict_operation (const trx_t *trx)) |
UNIV_INLINE void | trx_set_dict_operation (trx_t *trx, enum trx_dict_op_t op) |
UNIV_INLINE ibool | trx_state_eq (const trx_t *trx, trx_state_t state)) |
UNIV_INTERN ibool | trx_assert_started (const trx_t *trx)) |
UNIV_INTERN ibool | trx_is_interrupted (const trx_t *trx) |
UNIV_INTERN ibool | trx_is_strict (trx_t *trx) |
UNIV_INTERN ibool | trx_weight_ge (const trx_t *a, const trx_t *b) |
UNIV_INLINE const char * | trx_get_que_state_str (const trx_t *trx) |
UNIV_INTERN void | trx_assign_rseg (trx_t *trx) |
Variables | |
sess_t * | trx_dummy_sess |
rw_lock_t * | btr_search_latch_temp |
The latch protecting the adaptive search system. |
The transaction
Created 3/26/1996 Heikki Tuuri
#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 | ( | t | ) |
Assert that an autocommit non-locking select cannot be in the ro_trx_list nor the rw_trx_list and that it is a read-only transaction. The tranasction must be in the mysql_trx_list.
#define btr_search_latch (*btr_search_latch_temp) |
The latch protecting the adaptive search system
#define trx_is_ac_nl_ro | ( | t | ) | ((t)->read_only && trx_is_autocommit_non_locking((t))) |
Determine if the transaction is a non-locking autocommit select with an explicit check for the read-only status.
t | transaction |
#define trx_is_autocommit_non_locking | ( | t | ) | ((t)->auto_commit && (t)->will_lock == 0) |
Determine if the transaction is a non-locking autocommit select (implied read-only).
t | transaction |
#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 | ) |
Acquire the trx->mutex.
#define trx_mutex_exit | ( | t | ) |
Release the trx->mutex.
#define trx_mutex_own | ( | t | ) | mutex_own(&t->mutex) |
Test if trx->mutex is owned.
#define TRX_SIG_OTHER_SESS |
#define TRX_SIG_SELF |
#define trx_start_for_ddl | ( | t, | |
o | |||
) |
#define trx_start_if_not_started | ( | t | ) |
#define trx_start_if_not_started_xa | ( | t | ) |
#define TRX_WEIGHT | ( | t | ) | ((t)->undo_no + UT_LIST_GET_LEN((t)->lock.trx_locks)) |
Calculates the "weight" of a transaction. The weight of one transaction is estimated as the number of altered rows + the number of locked rows.
t | transaction |
enum commit_node_state |
UNIV_INTERN trx_t* trx_allocate_for_background | ( | void | ) |
Creates a transaction object for background operations by the master thread.
UNIV_INTERN trx_t* trx_allocate_for_mysql | ( | void | ) |
Creates a transaction object for MySQL.
Asserts that a transaction has been started. The caller must hold trx_sys->mutex.
trx | in: transaction |
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.
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
UNIV_INTERN void trx_free_for_mysql | ( | trx_t * | trx | ) |
Frees a transaction object for MySQL. in, own: trx object
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 |
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.
Retrieves the error_info field from a trx.
trx | in: trx object |
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.
Retrieves transaction's que state in a human readable string. The string should not be free()'d or modified.
trx | in: transaction |
This function is used to find one X/Open XA distributed transaction which is in the prepared state
Determines if the currently running transaction has been interrupted.
Determines if the currently running transaction is in strict mode.
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.
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
Releases the search latch if trx has reserved it.
trx | 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
trx | in: transaction struct |
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
trx | in: transaction struct |
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
Flag a transaction a dictionary operation.
trx | in/out: transaction |
op | in: operation, not TRX_DICT_OP_NONE |
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.
sess_t* trx_dummy_sess |
Dummy session used currently in MySQL interface