MySQL 8.0.40
Source Code Documentation
|
The transaction. More...
#include <atomic>
#include <set>
#include "ha_prototypes.h"
#include "dict0types.h"
#include "trx0types.h"
#include "ut0new.h"
#include "lock0types.h"
#include "mem0mem.h"
#include "que0types.h"
#include "trx0xa.h"
#include "usr0types.h"
#include "ut0vec.h"
#include "fts0fts.h"
#include "read0read.h"
#include "sql/handler.h"
#include "srv0srv.h"
#include "trx0trx.ic"
Go to the source code of this file.
Classes | |
struct | trx_lock_t |
Latching protocol for trx_lock_t::que_state. More... | |
struct | trx_undo_ptr_t |
The transaction handle. More... | |
struct | trx_rsegs_t |
Rollback segments assigned to a transaction for undo logging. More... | |
struct | trx_t |
struct | commit_node_t |
Commit command node in a query graph. More... | |
class | TrxInInnoDB |
Track if a transaction is executing inside InnoDB code. More... | |
Macros | |
#define | TRX_ISO_READ_UNCOMMITTED trx_t::READ_UNCOMMITTED |
#define | TRX_ISO_READ_COMMITTED trx_t::READ_COMMITTED |
#define | TRX_ISO_REPEATABLE_READ trx_t::REPEATABLE_READ |
#define | TRX_ISO_SERIALIZABLE trx_t::SERIALIZABLE |
#define | trx_mutex_enter_low(t, first_of_two) |
Please do not use this low-level macro. More... | |
#define | trx_mutex_enter(t) trx_mutex_enter_low(t, false) |
Acquire the trx->mutex (and promise not to request any more). More... | |
#define | trx_mutex_enter_first_of_two(t) trx_mutex_enter_low(t, true) |
Acquire the trx->mutex (and indicate we might request one more). More... | |
#define | trx_mutex_exit(t) |
Release the trx->mutex. More... | |
Typedefs | |
typedef std::vector< ib_lock_t *, ut::allocator< ib_lock_t * > > | lock_pool_t |
typedef std::set< dict_table_t *, std::less< dict_table_t * >, ut::allocator< dict_table_t * > > | trx_mod_tables_t |
Type used to store the list of tables that are modified by a given transaction. More... | |
Enumerations | |
enum | trx_rseg_type_t { TRX_RSEG_TYPE_NONE = 0 , TRX_RSEG_TYPE_REDO , TRX_RSEG_TYPE_NOREDO } |
enum | commit_node_state { COMMIT_NODE_SEND = 1 , COMMIT_NODE_WAIT } |
Commit node states. More... | |
Functions | |
void | trx_set_flush_observer (trx_t *trx, Flush_observer *observer) |
Set flush observer for the transaction. More... | |
void | trx_set_detailed_error (trx_t *trx, const char *msg) |
Set detailed error message for the transaction. More... | |
void | trx_set_detailed_error_from_file (trx_t *trx, FILE *file) |
Set detailed error message for the transaction from a file. More... | |
static const dict_index_t * | trx_get_error_index (const trx_t *trx) |
Retrieves the error_info field from a trx. More... | |
trx_t * | trx_allocate_for_mysql (void) |
Creates a transaction object for MySQL. More... | |
trx_t * | trx_allocate_for_background (void) |
Creates a transaction object for background operations by the master thread. More... | |
void | trx_resurrect_locks (bool all) |
Resurrect table locks for resurrected transactions. More... | |
void | trx_clear_resurrected_table_ids () |
Clear all resurrected table IDs. More... | |
void | trx_free_resurrected (trx_t *trx) |
Free and initialize a transaction object instantiated during recovery. More... | |
void | trx_free_for_background (trx_t *trx) |
Free a transaction that was allocated by background or user threads. More... | |
void | trx_free_prepared_or_active_recovered (trx_t *trx) |
At shutdown, frees a transaction object that represents either: More... | |
void | trx_free_for_mysql (trx_t *trx) |
Free a transaction object for MySQL. More... | |
void | trx_disconnect_plain (trx_t *trx) |
Disconnect a transaction from MySQL. More... | |
void | trx_disconnect_prepared (trx_t *trx) |
Disconnect a prepared transaction from MySQL. More... | |
void | trx_lists_init_at_db_start (void) |
Creates trx objects for transactions and initializes the trx list of trx_sys at database start. More... | |
void | trx_start_if_not_started_xa_low (trx_t *trx, bool read_write) |
Starts the transaction if it is not yet started. More... | |
void | trx_start_if_not_started_low (trx_t *trx, bool read_write) |
Starts the transaction if it is not yet started. More... | |
void | trx_start_internal_low (trx_t *trx) |
Starts a transaction for internal processing. More... | |
void | trx_start_internal_read_only_low (trx_t *trx) |
Starts a read-only transaction for internal processing. More... | |
void | trx_commit (trx_t *trx) |
Commits a transaction. More... | |
void | trx_commit_low (trx_t *trx, mtr_t *mtr) |
Commits a transaction and a mini-transaction. More... | |
void | trx_cleanup_at_db_startup (trx_t *trx) |
Cleans up a transaction at database startup. More... | |
dberr_t | trx_commit_for_mysql (trx_t *trx) |
Does the transaction commit for MySQL. More... | |
dberr_t | trx_prepare_for_mysql (trx_t *trx) |
Does the transaction prepare for MySQL. More... | |
int | trx_recover_for_mysql (XA_recover_txn *txn_list, ulint len, MEM_ROOT *mem_root) |
This function is used to find number of prepared transactions and their transaction objects for a recovery. More... | |
int | trx_recover_tc_for_mysql (Xa_state_list &xa_list) |
Find prepared transactions that are marked as prepared in TC, for recovery purposes. More... | |
trx_t * | trx_get_trx_by_xid (const XID *xid) |
This function is used to find one X/Open XA distributed transaction which is in the prepared state. More... | |
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. More... | |
void | trx_mark_sql_stat_end (trx_t *trx) |
Marks the latest SQL statement ended. More... | |
ReadView * | trx_assign_read_view (trx_t *trx) |
Assigns a read view for a consistent read query. More... | |
static ReadView * | trx_get_read_view (trx_t *trx) |
static const ReadView * | trx_get_read_view (const trx_t *trx) |
void | trx_commit_or_rollback_prepare (trx_t *trx) |
Prepares a transaction for commit/rollback. More... | |
commit_node_t * | trx_commit_node_create (mem_heap_t *heap) |
Creates a commit command node struct. More... | |
que_thr_t * | trx_commit_step (que_thr_t *thr) |
Performs an execution step for a commit type node in a query graph. More... | |
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. More... | |
void | trx_print_latched (FILE *f, const trx_t *trx, ulint max_query_len) |
Prints info about a transaction. More... | |
void | trx_print (FILE *f, const trx_t *trx, ulint max_query_len) |
Prints info about a transaction. More... | |
static enum trx_dict_op_t | trx_get_dict_operation (const trx_t *trx) |
Determine if a transaction is a dictionary operation. More... | |
static void | trx_set_dict_operation (trx_t *trx, enum trx_dict_op_t op) |
Flag a transaction a dictionary operation. More... | |
static bool | trx_state_eq (const trx_t *trx, trx_state_t state) |
Determines if a transaction is in the given state. More... | |
bool | trx_can_be_handled_by_current_thread (const trx_t *trx) |
Determines if trx can be handled by current thread, which is when trx->mysql_thd is nullptr (a "background" trx) or equals current_thd. More... | |
bool | trx_can_be_handled_by_current_thread_or_is_hp_victim (const trx_t *trx) |
Determines if trx can be handled by current thread, which is when trx->mysql_thd is nullptr (a "background" trx) or equals current_thd, or is a victim being killed by HP transaction run by the current thread. More... | |
bool | trx_assert_started (const trx_t *trx) |
Asserts that a transaction has been started. More... | |
bool | trx_is_interrupted (const trx_t *trx) |
Determines if the currently running transaction has been interrupted. More... | |
bool | trx_is_strict (trx_t *trx) |
Determines if the currently running transaction is in strict mode. More... | |
bool | trx_weight_ge (const trx_t *a, const trx_t *b) |
Compares the "weight" (or size) of two transactions. More... | |
static const char * | trx_get_que_state_str (const trx_t *trx) |
Retrieves transaction's que state in a human readable string. More... | |
static trx_id_t | trx_get_id_for_print (const trx_t *trx) |
Retreieves the transaction ID. More... | |
void | trx_assign_rseg_temp (trx_t *trx) |
Assign a temp-tablespace bound rollback-segment to a transaction. More... | |
void | trx_pool_init () |
Create the trx_t pool. More... | |
void | trx_pool_close () |
Destroy the trx_t pool. More... | |
void | trx_set_rw_mode (trx_t *trx) |
Set the transaction as a read-write transaction if it is not already tagged as such. More... | |
static const trx_t * | trx_arbitrate (const trx_t *requestor, const trx_t *holder) |
static bool | trx_is_high_priority (const trx_t *trx) |
void | trx_kill_blocking (trx_t *trx) |
If this is a high priority transaction, kill all transactions that are blocking this transaction from acquiring locks. More... | |
static bool | trx_is_rseg_updated (const trx_t *trx) |
Check if redo/noredo rseg is modified for insert/update. More... | |
static std::chrono::seconds | trx_lock_wait_timeout_get (const trx_t *t) |
Transactions that aren't started by the MySQL server don't set the trx_t::mysql_thd field. More... | |
static bool | trx_is_autocommit_non_locking (const trx_t *t) |
Determine if the transaction is a non-locking autocommit select (implied read-only). More... | |
static void | check_trx_state (const trx_t *t) |
Check transaction state. More... | |
static void | assert_trx_in_rw_list (const trx_t *t) |
Assert that the transaction is in the trx_sys_t::rw_trx_list. More... | |
static void | assert_trx_is_free (const trx_t *t) |
Check if transaction is free so that it can be re-initialized. More... | |
static void | assert_trx_is_inactive (const trx_t *t) |
Check if transaction is in-active so that it can be freed and put back to transaction pool. More... | |
static void | assert_trx_nonlocking_or_in_list (const trx_t *t) |
Assert that an autocommit non-locking select cannot be in the rw_trx_list and that it is a read-only transaction. More... | |
static bool | trx_is_ac_nl_ro (const trx_t *t) |
Determine if the transaction is a non-locking autocommit select with an explicit check for the read-only status. More... | |
static void | trx_reference (trx_t *trx) |
Increase the reference count. More... | |
static void | trx_release_reference (trx_t *trx) |
Release the transaction. More... | |
static bool | trx_is_referenced (const trx_t *t) |
Check if the transaction is being referenced. More... | |
static uint64_t | TRX_WEIGHT (const trx_t *t) |
Calculates the "weight" of a transaction. More... | |
static void | trx_start_if_not_started_xa (trx_t *t, bool rw, ut::Location loc) |
static void | trx_start_if_not_started (trx_t *t, bool rw, ut::Location l) |
static void | trx_start_internal (trx_t *t, ut::Location loc) |
static void | trx_start_internal_read_only (trx_t *t, ut::Location loc) |
bool | trx_was_started (const trx_t *trx) |
Check if transaction was started. More... | |
bool | trx_is_started (const trx_t *trx) |
Check if transaction is started. More... | |
bool | trx_mutex_own (const trx_t *trx) |
Test if trx->mutex is owned by the current thread. More... | |
void | trx_before_mutex_enter (const trx_t *trx, bool allow_another) |
Verifies the invariants and records debug state related to latching rules. More... | |
void | trx_before_mutex_exit (const trx_t *trx) |
Verifies the invariants and records debug state related to latching rules. More... | |
bool | trx_is_mysql_xa (const trx_t *trx) |
Check if transaction is internal XA transaction. More... | |
void | trx_sys_update_binlog_position (trx_t *trx) |
Update transaction binlog file name and position from session THD. More... | |
bool | trx_is_prepared_in_tc (trx_t const *trx) |
Checks whether or not the transaction has been marked as prepared in TC. More... | |
dberr_t | trx_set_prepared_in_tc_for_mysql (trx_t *trx) |
Does the 2nd phase of an XA transaction prepare for MySQL. More... | |
Variables | |
std::vector< std::pair< trx_id_t, table_id_t > > | to_rollback_trx_tables |
sess_t * | trx_dummy_sess |
Dummy session used currently in MySQL interface. More... | |
constexpr uint32_t | TRX_QUE_STATE_STR_MAX_LEN = 12 |
The transaction.
Created 3/26/1996 Heikki Tuuri
#define TRX_ISO_READ_COMMITTED trx_t::READ_COMMITTED |
#define TRX_ISO_READ_UNCOMMITTED trx_t::READ_UNCOMMITTED |
#define TRX_ISO_REPEATABLE_READ trx_t::REPEATABLE_READ |
#define TRX_ISO_SERIALIZABLE trx_t::SERIALIZABLE |
#define trx_mutex_enter | ( | t | ) | trx_mutex_enter_low(t, false) |
Acquire the trx->mutex (and promise not to request any more).
#define trx_mutex_enter_first_of_two | ( | t | ) | trx_mutex_enter_low(t, true) |
Acquire the trx->mutex (and indicate we might request one more).
#define trx_mutex_enter_low | ( | t, | |
first_of_two | |||
) |
Please do not use this low-level macro.
Use trx_mutex_enter(t) instead. In rare cases where you need to take two trx->mutex-es, take the first one using trx_mutex_enter_first_of_two(t1), and the second one with trx_mutex(2)
#define trx_mutex_exit | ( | t | ) |
Release the trx->mutex.
typedef std::vector<ib_lock_t *, ut::allocator<ib_lock_t *> > lock_pool_t |
typedef std::set<dict_table_t *, std::less<dict_table_t *>, ut::allocator<dict_table_t *> > trx_mod_tables_t |
Type used to store the list of tables that are modified by a given transaction.
We store pointers to the table objects in memory because we know that a table object will not be destroyed while a transaction that modified it is running.
enum commit_node_state |
enum trx_rseg_type_t |
|
inlinestatic |
Assert that the transaction is in the trx_sys_t::rw_trx_list.
|
inlinestatic |
Check if transaction is free so that it can be re-initialized.
t | transaction handle |
|
inlinestatic |
Check if transaction is in-active so that it can be freed and put back to transaction pool.
t | transaction handle |
|
inlinestatic |
Assert that an autocommit non-locking select cannot be in the rw_trx_list and that it is a read-only transaction.
The transaction must be in the mysql_trx_list.
|
inlinestatic |
Check transaction state.
trx_t * trx_allocate_for_background | ( | void | ) |
Creates a transaction object for background operations by the master thread.
trx_t * trx_allocate_for_mysql | ( | void | ) |
Creates a transaction object for MySQL.
[in] | requestor | Transaction requesting the lock |
[in] | holder | Transaction holding the lock |
bool trx_assert_started | ( | const trx_t * | trx | ) |
Asserts that a transaction has been started.
The caller must hold trx_sys->mutex.
The caller must hold trx_sys->mutex.
trx | in: transaction |
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. in: active transaction
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.
trx | in/out: active transaction |
void trx_assign_rseg_temp | ( | trx_t * | trx | ) |
Assign a temp-tablespace bound rollback-segment to a transaction.
[in,out] | trx | transaction that involves write to temp-table. |
void trx_before_mutex_enter | ( | const trx_t * | trx, |
bool | allow_another | ||
) |
Verifies the invariants and records debug state related to latching rules.
Called during trx_mutex_enter before the actual mutex acquisition.
[in] | trx | The transaction for which trx_mutex_enter(trx) is called |
[in] | allow_another | If false, then no further calls to trx_mutex_enter are allowed, until trx_mutex_exit(). If true, then this must be the first trx acquisition and we will allow one more. |
void trx_before_mutex_exit | ( | const trx_t * | trx | ) |
Verifies the invariants and records debug state related to latching rules.
Called during trx_mutex_exit before the actual mutex release.
[in] | trx | The transaction for which trx_mutex_exit(trx) is called |
bool trx_can_be_handled_by_current_thread | ( | const trx_t * | trx | ) |
Determines if trx can be handled by current thread, which is when trx->mysql_thd is nullptr (a "background" trx) or equals current_thd.
[in] | trx | The transaction to check |
bool trx_can_be_handled_by_current_thread_or_is_hp_victim | ( | const trx_t * | trx | ) |
Determines if trx can be handled by current thread, which is when trx->mysql_thd is nullptr (a "background" trx) or equals current_thd, or is a victim being killed by HP transaction run by the current thread.
[in] | trx | The transaction to check |
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
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.
trx | in: transaction |
void trx_clear_resurrected_table_ids | ( | ) |
Clear all resurrected table IDs.
Needs to be called after all tables locks are resurrected.
void trx_commit | ( | trx_t * | trx | ) |
Commits a transaction.
in/out: transaction
trx | in/out: transaction |
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.
in/out: transaction
trx | in/out: transaction |
Does the transaction commit for MySQL.
trx | in/out: transaction |
Commits a transaction and a mini-transaction.
[in,out] | trx | Transaction |
[in,out] | mtr | Mini-transaction (will be committed), or null if trx made no modifications |
commit_node_t * trx_commit_node_create | ( | mem_heap_t * | heap | ) |
Creates a commit command node struct.
heap | in: mem heap where created |
void trx_commit_or_rollback_prepare | ( | trx_t * | trx | ) |
Prepares a transaction for commit/rollback.
in/out: transaction
trx | in/out: transaction |
Performs an execution step for a commit type node in a query graph.
thr | in: query thread |
|
inline |
Disconnect a transaction from MySQL.
[in,out] | trx | transaction |
void trx_disconnect_prepared | ( | trx_t * | trx | ) |
Disconnect a prepared transaction from MySQL.
[in,out] | trx | transaction |
void trx_free_for_background | ( | trx_t * | trx | ) |
Free a transaction that was allocated by background or user threads.
[in,out] | trx | transaction object to free |
void trx_free_for_mysql | ( | trx_t * | trx | ) |
Free a transaction object for MySQL.
[in,out] | trx | transaction |
void trx_free_prepared_or_active_recovered | ( | trx_t * | trx | ) |
At shutdown, frees a transaction object that represents either:
[in,out] | trx | transaction object to free |
void trx_free_resurrected | ( | trx_t * | trx | ) |
Free and initialize a transaction object instantiated during recovery.
[in,out] | trx | transaction object to free and initialize |
|
inlinestatic |
Determine if a transaction is a dictionary operation.
|
inlinestatic |
Retrieves the error_info field from a trx.
Retreieves the transaction ID.
In a given point in time it is guaranteed that IDs of the running transactions are unique. The values returned by this function for readonly transactions may be reused, so a subsequent RO transaction may get the same ID as a RO transaction that existed in the past. The values returned by this function should be used for printing purposes only.
[in] | trx | transaction whose id to retrieve |
|
inlinestatic |
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.
[in] | xid | X/Open XA transaction identifier |
|
inlinestatic |
Determine if the transaction is a non-locking autocommit select with an explicit check for the read-only status.
t | transaction |
|
inlinestatic |
Determine if the transaction is a non-locking autocommit select (implied read-only).
t | transaction |
|
inlinestatic |
[in] | trx | Transaction to check |
bool trx_is_interrupted | ( | const trx_t * | trx | ) |
Determines if the currently running transaction has been interrupted.
trx | in: transaction |
bool trx_is_mysql_xa | ( | const trx_t * | trx | ) |
Check if transaction is internal XA transaction.
[in] | trx | transaction |
bool trx_is_prepared_in_tc | ( | trx_t const * | trx | ) |
Checks whether or not the transaction has been marked as prepared in TC.
[in] | trx | the transaction |
|
inlinestatic |
Check if the transaction is being referenced.
|
inlinestatic |
Check if redo/noredo rseg is modified for insert/update.
[in] | trx | Transaction to check |
|
inline |
Check if transaction is started.
[in] | trx | Transaction whose state we need to check |
bool trx_is_strict | ( | trx_t * | trx | ) |
Determines if the currently running transaction is in strict mode.
trx | in: transaction |
void trx_kill_blocking | ( | trx_t * | trx | ) |
If this is a high priority transaction, kill all transactions that are blocking this transaction from acquiring locks.
[in,out] | trx | High priority transaction |
Kill the transactions in the lock acquisition order old -> new.
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.
Rollback segments 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.
|
inlinestatic |
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.
t | transaction |
void trx_mark_sql_stat_end | ( | trx_t * | trx | ) |
Marks the latest SQL statement ended.
in: trx handle
trx | in: trx handle |
|
inline |
Test if trx->mutex is owned by the current thread.
void trx_pool_close | ( | ) |
Destroy the trx_t pool.
void trx_pool_init | ( | ) |
Create the trx_t pool.
Does the transaction prepare for MySQL.
[in,out] | trx | Transaction instance to prepare |
Prints info about a transaction.
Acquires and releases lock_sys exclusive global latch and trx_sys->mutex.
[in] | f | output stream |
[in] | trx | transaction |
[in] | max_query_len | max query length to print, must be positive |
Prints info about a transaction.
The caller must hold lock_sys exclusive global latch and trx_sys->mutex.
[in] | f | output stream |
[in] | trx | transaction |
[in] | max_query_len | max query length to print, must be positive |
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. in: mem_heap_get_size(trx->lock.lock_heap)
Caller must hold trx_sys->mutex.
f | in: output stream |
trx | in: transaction |
max_query_len | in: max query length to print, must be positive |
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) |
int trx_recover_for_mysql | ( | XA_recover_txn * | txn_list, |
ulint | len, | ||
MEM_ROOT * | mem_root | ||
) |
This function is used to find number of prepared transactions and their transaction objects for a recovery.
txn_list | in/out: prepared transactions |
len | in: number of slots in xid_list |
mem_root | in: memory for table names |
int trx_recover_tc_for_mysql | ( | Xa_state_list & | xa_list | ) |
Find prepared transactions that are marked as prepared in TC, for recovery purposes.
[in,out] | xa_list | prepared transactions state |
|
inlinestatic |
Increase the reference count.
If the transaction is in state TRX_STATE_COMMITTED_IN_MEMORY then the transaction is considered committed and the reference count is not incremented.
trx | Transaction that is being referenced |
|
inlinestatic |
Release the transaction.
Decrease the reference count.
trx | Transaction that is being released |
void trx_resurrect_locks | ( | bool | all | ) |
Resurrect table locks for resurrected transactions.
[in] | all | false: resurrect locks for dictionary transactions, true : resurrect locks for all transactions. |
void trx_set_detailed_error | ( | trx_t * | trx, |
const char * | msg | ||
) |
Set detailed error message for the transaction.
[in] | trx | Transaction struct |
[in] | msg | Detailed error message |
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
Note that the file is rewinded before reading from it.
trx | in: transaction struct |
file | in: file to read message from |
|
inlinestatic |
Flag a transaction a dictionary operation.
[in,out] | trx | transaction |
[in] | op | operation, not TRX_DICT_OP_NONE |
void trx_set_flush_observer | ( | trx_t * | trx, |
Flush_observer * | observer | ||
) |
Set flush observer for the transaction.
[in,out] | trx | transaction struct |
[in] | observer | flush observer |
Does the 2nd phase of an XA transaction prepare for MySQL.
[in,out] | trx | Transaction instance to finish prepare |
void trx_set_rw_mode | ( | trx_t * | trx | ) |
Set the transaction as a read-write transaction if it is not already tagged as such.
[in,out] | trx | Transaction that needs to be "upgraded" to RW from RO |
Read-only transactions that are writing to temporary tables are assigned an ID and a rollback segment but are not added to the trx read-write list because their updates should not be visible to other transactions and therefore their changes can be ignored by by MVCC.
trx | in/out: transaction that is RW |
|
inlinestatic |
void trx_start_if_not_started_low | ( | trx_t * | trx, |
bool | read_write | ||
) |
Starts the transaction if it is not yet started.
[in] | trx | Transaction |
[in] | read_write | True if read write transaction |
|
inlinestatic |
void trx_start_if_not_started_xa_low | ( | trx_t * | trx, |
bool | read_write | ||
) |
Starts the transaction if it is not yet started.
[in,out] | trx | Transaction |
[in] | read_write | True if read write transaction |
|
inlinestatic |
void trx_start_internal_low | ( | trx_t * | trx | ) |
Starts a transaction for internal processing.
in/out: transaction
trx | in/out: transaction |
|
inlinestatic |
void trx_start_internal_read_only_low | ( | trx_t * | trx | ) |
Starts a read-only transaction for internal processing.
[in,out] | trx | transaction to be started |
|
inlinestatic |
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 RW transaction must be in trx_sys->rw_trx_list.
[in] | trx | Transaction. |
[in] | state | State. |
void trx_sys_update_binlog_position | ( | trx_t * | trx | ) |
Update transaction binlog file name and position from session THD.
[in,out] | trx | current transaction. |
|
inline |
Check if transaction was started.
Note, that after the check situation might have already been changed (and note that holding the trx_sys->mutex does not prevent state transitions for read-only transactions).
[in] | trx | Transaction whose state we need to check |
|
inlinestatic |
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 |
Compares the "weight" (or size) of two transactions.
Transactions that have edited non-transactional tables are considered heavier than ones that have not.
Transactions that have edited non-transactional tables are considered heavier than ones that have not.
a | in: transaction to be compared |
b | in: transaction to be compared |
|
extern |
|
extern |
Dummy session used currently in MySQL interface.
|
constexpr |