358 const trx_t *holder);
377 return (uint64_t{
reinterpret_cast<uintptr_t
>(trx)});
386typedef std::vector<ib_lock_t *, ut::allocator<ib_lock_t *>>
lock_pool_t;
593typedef std::set<dict_table_t *, std::less<dict_table_t *>,
935 std::chrono::system_clock::time_point{}};
936 static_assert(
decltype(
start_time)::is_always_lock_free);
1047#ifndef UNIV_HOTBACKUP
1132 ut_o(
return (
false));
1143#ifndef UNIV_HOTBACKUP
1229#define assert_trx_nonlocking_or_in_list(trx) ((void)0)
1310#define TRX_ISO_READ_UNCOMMITTED trx_t::READ_UNCOMMITTED
1311#define TRX_ISO_READ_COMMITTED trx_t::READ_COMMITTED
1312#define TRX_ISO_REPEATABLE_READ trx_t::REPEATABLE_READ
1313#define TRX_ISO_SERIALIZABLE trx_t::SERIALIZABLE
1323 const auto trx_state = trx->
state.load(std::memory_order_relaxed);
1383#define trx_mutex_enter_low(t, first_of_two) \
1385 ut_ad(!trx_mutex_own(t)); \
1386 ut_d(trx_before_mutex_enter(t, first_of_two)); \
1387 mutex_enter(&t->mutex); \
1391#define trx_mutex_enter(t) trx_mutex_enter_low(t, false)
1394#define trx_mutex_enter_first_of_two(t) trx_mutex_enter_low(t, true)
1397#define trx_mutex_exit(t) \
1399 ut_ad(trx_mutex_own(t)); \
1400 ut_d(trx_before_mutex_exit(t)); \
1401 mutex_exit(&t->mutex); \
1412 enter(trx, disable);
1436 const auto trx_state = trx->
state.load(std::memory_order_relaxed);
1554 ulint loop_count = 0;
1556 ulint sleep_time = 20;
1565 if (loop_count < 100) {
1568 }
else if (loop_count < 1000) {
1573 sleep_time = 100000;
1576 std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:47
We use Flush_observer to track flushing of non-redo logged pages in bulk create index(btr0load....
Definition: buf0flu.h:270
static bool is_view_active(ReadView *view)
Definition: read0read.h:80
Read view lists the trx ids of those transactions for which a consistent read should not see the modi...
Definition: read0types.h:48
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Track if a transaction is executing inside InnoDB code.
Definition: trx0trx.h:1406
static void begin_stmt(trx_t *trx)
Start statement requested for transaction.
Definition: trx0trx.h:1451
static void end_stmt(trx_t *trx)
Note an end statement for transaction.
Definition: trx0trx.h:1456
static void enter(trx_t *trx, bool disable)
Note that we have crossed into InnoDB code.
Definition: trx0trx.h:1469
static void wait(const trx_t *trx)
Wait for the asynchronous rollback to complete, if it is in progress.
Definition: trx0trx.h:1551
static bool is_aborted(const trx_t *trx)
Definition: trx0trx.h:1433
~TrxInInnoDB()
Destructor.
Definition: trx0trx.h:1417
static bool is_forced_rollback(const trx_t *trx)
Definition: trx0trx.h:1543
static bool is_async_rollback(const trx_t *trx)
Definition: trx0trx.h:1461
bool is_aborted() const
Definition: trx0trx.h:1422
static bool is_started(const trx_t *trx)
Definition: trx0trx.h:1585
static void exit(trx_t *trx)
Note that we are exiting InnoDB code.
Definition: trx0trx.h:1517
bool is_rollback_disabled() const
Definition: trx0trx.h:1426
trx_t * m_trx
Transaction instance crossing the handler boundary from the Server.
Definition: trx0trx.h:1593
TrxInInnoDB(trx_t *trx, bool disable=false)
Definition: trx0trx.h:1411
Class to maintain list of externally coordinated transactions and their current state at recovery.
Definition: handler.h:1259
Allocator that allows std::* containers to manage their memory through ut::malloc* and ut::free libra...
Definition: ut0new.h:2181
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
dberr_t
Definition: db0err.h:39
Data dictionary global types.
Full text search header file.
uint64_t doc_id_t
Document id type.
Definition: fts0fts.h:79
std::chrono::seconds thd_lock_wait_timeout(THD *thd)
Returns the lock wait timeout for the current connection.
Definition: ha_innodb.cc:1956
Prototypes for global functions in ha_innodb.cc that are called by InnoDB C code.
The transaction lock system global types.
uint64_t lsn_t
Type used for all log sequence number storage and arithmetic.
Definition: log0types.h:63
const std::string FILE("FILE")
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
Definition: gcs_xcom_synode.h:64
pid_type get_id()
Definition: process.h:48
Query graph global types.
bool srv_read_only_mode
Set if InnoDB must operate in read-only mode.
Definition: srv0srv.cc:200
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Commit command node in a query graph.
Definition: trx0trx.h:1346
enum commit_node_state state
node execution state
Definition: trx0trx.h:1348
que_common_t common
node type: QUE_NODE_COMMIT
Definition: trx0trx.h:1347
Data structure for an index.
Definition: dict0mem.h:1046
Information about changes in a single transaction affecting the FTS system.
Definition: fts0fts.h:229
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:302
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
Definition: que0types.h:51
Definition: que0que.h:301
Definition: que0que.h:242
Definition: usr0sess.h:54
Plain structure to store information about XA transaction id and a list of table names involved into ...
Definition: xa.h:290
Latching protocol for trx_lock_t::que_state.
Definition: trx0trx.h:410
std::atomic< bool > inherit_all
Used to indicate that every lock of this transaction placed on a record which is being purged should ...
Definition: trx0trx.h:567
trx_lock_t()=default
Default constructor.
std::atomic< ulint > n_rec_locks
Number of rec locks in this trx.
Definition: trx0trx.h:558
mem_heap_t * lock_heap
Memory heap for trx_locks.
Definition: trx0trx.h:533
bool start_stmt
The transaction called ha_innobase::start_stmt() to lock a table.
Definition: trx0trx.h:586
std::atomic< trx_t * > blocking_trx
If this transaction is waiting for a lock, then blocking_trx points to a transaction which holds a co...
Definition: trx0trx.h:448
trx_lock_list_t trx_locks
Locks requested by the transaction.
Definition: trx0trx.h:547
std::atomic< lock_t * > wait_lock
The lock request of this transaction is waiting for.
Definition: trx0trx.h:469
std::chrono::system_clock::time_point wait_started
Lock wait started at this time.
Definition: trx0trx.h:510
uint64_t trx_locks_version
Incremented each time a lock is added or removed from the trx->lock.trx_locks, so that the thread whi...
Definition: trx0trx.h:424
trx_que_t que_state
valid when trx->state == TRX_STATE_ACTIVE: TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, ...
Definition: trx0trx.h:416
bool in_rollback
When a transaction is forced to rollback due to a deadlock check or by another high priority transact...
Definition: trx0trx.h:581
lock_pool_t table_pool
Pre-allocated table locks.
Definition: trx0trx.h:524
ulint rec_cached
Next free record lock in pool.
Definition: trx0trx.h:527
ulint n_active_thrs
number of active query threads
Definition: trx0trx.h:414
std::atomic< trx_schedule_weight_t > schedule_weight
Weight of the waiting transaction used for scheduling.
Definition: trx0trx.h:575
bool was_chosen_as_deadlock_victim
when the transaction decides to wait for a lock, it sets this to false; if another transaction choose...
Definition: trx0trx.h:499
ib_vector_t * autoinc_locks
AUTOINC locks held by this transaction.
Definition: trx0trx.h:553
uint32_t wait_lock_type
Stores the type of the most recent lock for which this trx had to wait.
Definition: trx0trx.h:497
lock_pool_t rec_pool
Pre-allocated record locks.
Definition: trx0trx.h:521
ulint table_cached
Next free table lock in pool.
Definition: trx0trx.h:530
que_thr_t * wait_thr
query thread belonging to this trx that is in QUE_THR_LOCK_WAIT state.
Definition: trx0trx.h:518
A savepoint set with SQL's "SAVEPOINT savepoint_id" command.
Definition: trx0roll.h:168
The rollback segment memory object.
Definition: trx0types.h:177
Rollback segments assigned to a transaction for undo logging.
Definition: trx0trx.h:666
trx_undo_ptr_t m_noredo
undo log ptr holding reference to a rollback segment that resides in temp tablespace used for undo lo...
Definition: trx0trx.h:675
trx_undo_ptr_t m_redo
undo log ptr holding reference to a rollback segment that resides in system/undo tablespace used for ...
Definition: trx0trx.h:670
Transaction savepoint.
Definition: trx0types.h:148
Definition: trx0trx.h:684
const char * op_info
English text describing the current operation, or an empty string.
Definition: trx0trx.h:860
bool releases_gap_locks_at_prepare() const
Definition: trx0trx.h:1118
space_id_t undo_rseg_space
space id where last undo record was written
Definition: trx0trx.h:1013
bool is_recovered
false: a normal transaction true: a recovered transaction
Definition: trx0trx.h:844
uint32_t dict_operation_lock_mode
0, RW_S_LATCH, or RW_X_LATCH: the latch mode trx currently holds on dict_operation_lock.
Definition: trx0trx.h:927
uint32_t n_mysql_tables_in_use
number of Innobase tables used in the processing of the current SQL statement in MySQL
Definition: trx0trx.h:954
char * detailed_error
detailed error message for last error, or empty.
Definition: trx0trx.h:1103
bool allow_semi_consistent() const
Definition: trx0trx.h:1135
ulint magic_n
Definition: trx0trx.h:1112
ulint n_autoinc_rows
no.
Definition: trx0trx.h:1031
bool must_flush_log_later
this flag is set to true in trx_commit() if flush_log_later was true, and there were modifications by...
Definition: trx0trx.h:895
bool flush_log_later
Definition: trx0trx.h:889
no_list
Required during view creation to check for the view limit for transactions that are committing.
Definition: trx0trx.h:825
trx_dict_op_t dict_operation
Definition: trx0trx.h:908
THD * mysql_thd
MySQL thread handle corresponding to this trx, or NULL.
Definition: trx0trx.h:941
XID * xid
X/Open XA transaction identification to identify a transaction branch.
Definition: trx0trx.h:1085
fts_trx_t * fts_trx
FTS information, or NULL if transaction hasn't modified tables with FTS indexes (yet).
Definition: trx0trx.h:1049
undo_no_t undo_no
next undo log record number to assign; since the undo log is private for a transaction,...
Definition: trx0trx.h:1006
bool releases_non_matching_rows() const
Checks if this transaction releases locks on non matching records due to low isolation level.
Definition: trx0trx.h:1140
uint32_t will_lock
Will acquire some locks.
Definition: trx0trx.h:1044
ulint start_line
Track where it was started from.
Definition: trx0trx.h:1067
que_t * graph
query currently run in the session, or NULL if none; NOTE that the query belongs to the session,...
Definition: trx0trx.h:990
std::atomic< std::chrono::system_clock::time_point > start_time
Time the state last time became TRX_STATE_ACTIVE.
Definition: trx0trx.h:934
Flush_observer * flush_observer
flush observer
Definition: trx0trx.h:1105
TrxMutex mutex
Mutex protecting the fields state and lock (except some fields of lock, which are protected by lock_s...
Definition: trx0trx.h:715
doc_id_t fts_next_doc_id
Definition: trx0trx.h:1052
const char * mysql_log_file_name
if MySQL binlog is used, this field contains a pointer to the latest file name; this is NULL if binlo...
Definition: trx0trx.h:944
lint n_ref
Count of references, protected by trx_t::mutex.
Definition: trx0trx.h:1071
uint32_t in_innodb
if the thread is executing in the InnoDB context count > 0.
Definition: trx0trx.h:729
std::atomic_uint64_t version
Version of this instance.
Definition: trx0trx.h:1083
bool auto_commit
true if it is an autocommit
Definition: trx0trx.h:1043
bool is_dd_trx
True if the transaction is used for doing Non-locking Read-only Read Committed on DD tables.
Definition: trx0trx.h:1108
uint32_t flush_tables
if "covering" the FLUSH TABLES", count of tables being flushed.
Definition: trx0trx.h:1054
std::atomic< trx_state_t > state
State of the trx from the point of view of concurrency control and the valid state transitions.
Definition: trx0trx.h:809
isolation_level_t isolation_level
Current isolation level.
Definition: trx0trx.h:865
bool in_mysql_trx_list
true if in trx_sys->mysql_trx_list
Definition: trx0trx.h:971
bool api_auto_commit
automatic commit
Definition: trx0trx.h:1093
uint32_t in_depth
Track nested TrxInInnoDB count.
Definition: trx0trx.h:726
uint32_t n_tickets_to_enter_innodb
this can be > 0 only when declared_to_... is true; when we come to srv_conc_innodb_enter,...
Definition: trx0trx.h:922
bool skip_lock_inheritance
Definition: trx0trx.h:816
ulint pages_undone
number of undo log pages undone since the last undo log truncation
Definition: trx0trx.h:1028
bool ddl_must_flush
True if this trx involves dd table change, and must flush.
Definition: trx0trx.h:912
undo_no_t roll_limit
least undo number to undo during a partial rollback; 0 otherwise
Definition: trx0trx.h:1022
trx_rsegs_t rsegs
Definition: trx0trx.h:1021
bool is_registered
Definition: trx0trx.h:876
trx_t()=default
Default constructor.
uint64_t mysql_log_offset
if MySQL binlog is used, this field contains the end offset of the binlog entry
Definition: trx0trx.h:949
const char * start_file
Filename where it was started.
Definition: trx0trx.h:1068
lsn_t commit_lsn
lsn at the time of the commit
Definition: trx0trx.h:936
bool check_unique_secondary
normally true, but if the user wants to speed up inserts by suppressing unique key checks for seconda...
Definition: trx0trx.h:882
isolation_level_t
Definition: trx0trx.h:685
@ REPEATABLE_READ
this is the default; all consistent reads in the same trx read the same snapshot; full next-key locki...
Definition: trx0trx.h:703
@ READ_COMMITTED
somewhat Oracle-like isolation, except that in range UPDATE and DELETE we must block phantom rows wit...
Definition: trx0trx.h:698
@ SERIALIZABLE
all plain SELECTs are converted to LOCK IN SHARE MODE reads
Definition: trx0trx.h:707
@ READ_UNCOMMITTED
dirty read: non-locking SELECTs are performed so that we do not look at a possible earlier version of...
Definition: trx0trx.h:691
const dict_index_t * error_index
if the error number indicates a duplicate key error, a pointer to the problematic index is stored her...
Definition: trx0trx.h:983
trx_savept_t last_sql_stat_start
undo_no when the last sql statement was started: in case of an error, trx is rolled back down to this...
Definition: trx0trx.h:1016
bool is_read_uncommitted() const
Definition: trx0trx.h:1114
bool purge_sys_trx
This flag is set for trx_t objects used by the purge sys.
Definition: trx0trx.h:1101
trx_id_t id
transaction id
Definition: trx0trx.h:736
bool read_only
true if transaction is flagged as a READ-ONLY transaction.
Definition: trx0trx.h:1035
trx_savepoints
savepoints set with SAVEPOINT ..., oldest first
Definition: trx0trx.h:998
bool in_rw_trx_list
True iff in trx_sys->rw_trx_list.
Definition: trx0trx.h:964
bool api_trx
trx started by InnoDB API
Definition: trx0trx.h:1092
bool skip_gap_locks() const
Definition: trx0trx.h:1122
bool abort
if this flag is set then this transaction must abort when it can
Definition: trx0trx.h:732
bool in_truncate
Definition: trx0trx.h:914
bool declared_to_be_inside_innodb
this is true if we have declared this transaction in srv_conc_enter_innodb to be inside the InnoDB en...
Definition: trx0trx.h:917
std::atomic< std::thread::id > killed_by
The thread ID that wants to kill this transaction asynchronously.
Definition: trx0trx.h:846
bool check_foreigns
normally true, but if the user wants to suppress foreign key checks, (in table imports,...
Definition: trx0trx.h:867
bool persists_gtid
Transaction persists GTID.
Definition: trx0trx.h:1064
dberr_t error_state
DB_SUCCESS if no error, otherwise error number.
Definition: trx0trx.h:981
trx_list
list of transactions; protected by trx_sys->mutex.
Definition: trx0trx.h:822
trx_id_t no
transaction serialization number: max trx id shortly before the transaction is moved to COMMITTED_IN_...
Definition: trx0trx.h:738
ReadView * read_view
consistent read view used in the transaction, or NULL if not yet set
Definition: trx0trx.h:818
sess_t * sess
session of the trx, NULL if none
Definition: trx0trx.h:989
bool in_rollback
true when the transaction is executing a partial or full rollback
Definition: trx0trx.h:1025
bool read_write
if read and write operation
Definition: trx0trx.h:1094
UndoMutex undo_mutex
mutex protecting the fields in this section (down to undo_no_arr), EXCEPT last_sql_stat_start,...
Definition: trx0trx.h:1000
bool has_search_latch
true if this trx has latched the search system latch in S-mode.
Definition: trx0trx.h:901
trx_lock_t lock
Information about the transaction locks and state.
Definition: trx0trx.h:831
trx_mod_tables_t mod_tables
List of tables that were modified by this transaction.
Definition: trx0trx.h:1088
bool ddl_operation
True if this trx involves dd table change.
Definition: trx0trx.h:910
ulint error_key_num
if the index creation fails to a duplicate key error, a mysql key number of that index is stored here
Definition: trx0trx.h:986
uint32_t mysql_n_tables_locked
how many tables the current SQL statement uses, except those in consistent read
Definition: trx0trx.h:957
mysql_trx_list
list of transactions created for MySQL; protected by trx_sys->mutex
Definition: trx0trx.h:968
The transaction handle.
Definition: trx0trx.h:644
bool is_update()
Definition: trx0trx.h:654
bool is_insert_only()
Definition: trx0trx.h:649
trx_undo_t * insert_undo
pointer to the insert undo log, or NULL if no inserts performed yet
Definition: trx0trx.h:659
trx_undo_t * update_undo
pointer to the update undo log, or NULL if no update performed yet
Definition: trx0trx.h:661
trx_rseg_t * rseg
rollback segment assigned to the transaction, or NULL if not assigned yet
Definition: trx0trx.h:656
bool is_empty()
Definition: trx0trx.h:646
Transaction undo log memory object; this is protected by the undo_mutex in the corresponding transact...
Definition: trx0undo.h:339
const char * filename
Definition: ut0core.h:37
size_t line
Definition: ut0core.h:38
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification,...
Definition: xa.h:83
double seconds()
Definition: task.cc:310
static uint64_t trx_immutable_id(const trx_t *trx)
Provides an id of the transaction which does not change over time.
Definition: trx0trx.h:376
void trx_start_if_not_started_low(trx_t *trx, bool read_write)
Starts the transaction if it is not yet started.
Definition: trx0trx.cc:3362
bool trx_assert_started(const trx_t *trx)
Asserts that a transaction has been started.
Definition: trx0trx.cc:2698
static ReadView * trx_get_read_view(trx_t *trx)
void trx_set_flush_observer(trx_t *trx, Flush_observer *observer)
Set flush observer for the transaction.
Definition: trx0trx.cc:132
sess_t * trx_dummy_sess
Dummy session used currently in MySQL interface.
Definition: trx0trx.cc:94
bool trx_is_interrupted(const trx_t *trx)
Determines if the currently running transaction has been interrupted.
Definition: ha_innodb.cc:3124
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.
Definition: trx0trx.h:1203
bool trx_is_started(const trx_t *trx)
Check if transaction is started.
Definition: trx0trx.h:1332
static void trx_start_internal(trx_t *t, ut::Location loc)
Definition: trx0trx.h:1279
bool trx_was_started(const trx_t *trx)
Check if transaction was started.
Definition: trx0trx.h:1322
void trx_free_prepared_or_active_recovered(trx_t *trx)
At shutdown, frees a transaction object that represents either:
Definition: trx0trx.cc:597
void trx_free_for_background(trx_t *trx)
Free a transaction that was allocated by background or user threads.
Definition: trx0trx.cc:591
trx_t * trx_allocate_for_background(void)
Creates a transaction object for background operations by the master thread.
Definition: trx0trx.cc:520
que_thr_t * trx_commit_step(que_thr_t *thr)
Performs an execution step for a commit type node in a query graph.
Definition: trx0trx.cc:2393
static bool trx_is_high_priority(const trx_t *trx)
void trx_before_mutex_exit(const trx_t *trx)
Verifies the invariants and records debug state related to latching rules.
Definition: trx0trx.cc:2881
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.
Definition: trx0trx.h:595
void trx_pool_init()
Create the trx_t pool.
Definition: trx0trx.cc:428
void trx_free_for_mysql(trx_t *trx)
Free a transaction object for MySQL.
Definition: trx0trx.cc:684
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-o...
Definition: trx0trx.h:1237
void trx_kill_blocking(trx_t *trx)
If this is a high priority transaction, kill all transactions that are blocking this transaction from...
Definition: trx0trx.cc:3461
static void trx_start_if_not_started_xa(trx_t *t, bool rw, ut::Location loc)
Definition: trx0trx.h:1266
void trx_disconnect_plain(trx_t *trx)
Disconnect a transaction from MySQL.
Definition: trx0trx.cc:672
bool trx_weight_ge(const trx_t *a, const trx_t *b)
Compares the "weight" (or size) of two transactions.
Definition: trx0trx.cc:2895
static enum trx_dict_op_t trx_get_dict_operation(const trx_t *trx)
Determine if a transaction is a dictionary operation.
void trx_resurrect_locks(bool all)
Resurrect table locks for resurrected transactions.
Definition: trx0trx.cc:772
void trx_free_resurrected(trx_t *trx)
Free and initialize a transaction object instantiated during recovery.
Definition: trx0trx.cc:581
void trx_clear_resurrected_table_ids()
Clear all resurrected table IDs.
Definition: trx0trx.cc:826
void trx_print_latched(FILE *f, const trx_t *trx, ulint max_query_len)
Prints info about a transaction.
Definition: trx0trx.cc:2658
void trx_sys_update_binlog_position(trx_t *trx)
Update transaction binlog file name and position from session THD.
Definition: trx0trx.cc:3620
static void check_trx_state(const trx_t *t)
Check transaction state.
Definition: trx0trx.h:1165
int trx_recover_tc_for_mysql(Xa_state_list &xa_list)
Find prepared transactions that are marked as prepared in TC, for recovery purposes.
Definition: trx0trx.cc:3248
static void trx_start_if_not_started(trx_t *t, bool rw, ut::Location l)
Definition: trx0trx.h:1273
void trx_mark_sql_stat_end(trx_t *trx)
Marks the latest SQL statement ended.
Definition: trx0trx.cc:2512
const char * trx_state_string(trx_state_t state)
Human readable transaction state, for diagnostic purposes.
Definition: trx0trx.ic:310
void trx_commit(trx_t *trx)
Commits a transaction.
Definition: trx0trx.cc:2253
std::vector< std::pair< trx_id_t, table_id_t > > to_rollback_trx_tables
Definition: trx0trx.cc:91
void trx_before_mutex_enter(const trx_t *trx, bool allow_another)
Verifies the invariants and records debug state related to latching rules.
Definition: trx0trx.cc:2854
static uint64_t TRX_WEIGHT(const trx_t *t)
Calculates the "weight" of a transaction.
Definition: trx0trx.h:1261
void trx_set_rw_mode(trx_t *trx)
Set the transaction as a read-write transaction if it is not already tagged as such.
Definition: trx0trx.cc:3418
std::vector< ib_lock_t *, ut::allocator< ib_lock_t * > > lock_pool_t
Definition: trx0trx.h:386
static void trx_reference(trx_t *trx)
Increase the reference count.
static bool trx_is_referenced(const trx_t *t)
Check if the transaction is being referenced.
Definition: trx0trx.h:1255
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 "backg...
Definition: trx0trx.cc:2690
ReadView * trx_assign_read_view(trx_t *trx)
Assigns a read view for a consistent read query.
Definition: trx0trx.cc:2315
void trx_assign_rseg_temp(trx_t *trx)
Assign a temp-tablespace bound rollback-segment to a transaction.
Definition: trx0trx.cc:1279
void trx_set_detailed_error_from_file(trx_t *trx, FILE *file)
Set detailed error message for the transaction from a file.
Definition: trx0trx.cc:145
commit_node_t * trx_commit_node_create(mem_heap_t *heap)
Creates a commit command node struct.
Definition: trx0trx.cc:2379
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 "backg...
Definition: trx0trx.cc:2678
static const char * trx_get_que_state_str(const trx_t *trx)
Retrieves transaction's que state in a human readable string.
bool trx_is_prepared_in_tc(trx_t const *trx)
Checks whether or not the transaction has been marked as prepared in TC.
Definition: trx0trx.cc:3634
static bool trx_state_eq(const trx_t *trx, trx_state_t state)
Determines if a transaction is in the given state.
#define trx_mutex_exit(t)
Release the trx->mutex.
Definition: trx0trx.h:1397
void trx_start_internal_read_only_low(trx_t *trx)
Starts a read-only transaction for internal processing.
Definition: trx0trx.cc:3401
static trx_id_t trx_get_id_for_print(const trx_t *trx)
Retreieves the transaction ID.
constexpr uint32_t TRX_QUE_STATE_STR_MAX_LEN
Definition: trx0trx.h:318
static void trx_set_dict_operation(trx_t *trx, enum trx_dict_op_t op)
Flag a transaction a dictionary operation.
void trx_commit_low(trx_t *trx, mtr_t *mtr)
Commits a transaction and a mini-transaction.
Definition: trx0trx.cc:2161
static void trx_release_reference(trx_t *trx)
Release the transaction.
bool trx_is_mysql_xa(const trx_t *trx)
Check if transaction is internal XA transaction.
Definition: trx0trx.cc:2978
static bool trx_is_rseg_updated(const trx_t *trx)
Check if redo/noredo rseg is modified for insert/update.
static const dict_index_t * trx_get_error_index(const trx_t *trx)
Retrieves the error_info field from a trx.
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 rec...
Definition: trx0trx.cc:3192
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.
Definition: trx0trx.cc:3309
#define trx_mutex_enter(t)
Acquire the trx->mutex (and promise not to request any more).
Definition: trx0trx.h:1391
static bool trx_is_autocommit_non_locking(const trx_t *t)
Determine if the transaction is a non-locking autocommit select (implied read-only).
Definition: trx0trx.h:1160
void trx_pool_close()
Destroy the trx_t pool.
Definition: trx0trx.cc:436
static const trx_t * trx_arbitrate(const trx_t *requestor, const trx_t *holder)
bool trx_is_strict(trx_t *trx)
Determines if the currently running transaction is in strict mode.
Definition: ha_innodb.cc:3131
void trx_print(FILE *f, const trx_t *trx, ulint max_query_len)
Prints info about a transaction.
Definition: trx0trx.cc:2669
static void assert_trx_in_rw_list(const trx_t *t)
Assert that the transaction is in the trx_sys_t::rw_trx_list.
Definition: trx0trx.h:1182
void trx_start_internal_low(trx_t *trx)
Starts a transaction for internal processing.
Definition: trx0trx.cc:3387
dberr_t trx_set_prepared_in_tc_for_mysql(trx_t *trx)
Does the 2nd phase of an XA transaction prepare for MySQL.
Definition: trx0trx.cc:3649
trx_t * trx_allocate_for_mysql(void)
Creates a transaction object for MySQL.
Definition: trx0trx.cc:532
void trx_lists_init_at_db_start(void)
Creates trx objects for transactions and initializes the trx list of trx_sys at database start.
Definition: trx0trx.cc:1081
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 ==...
Definition: trx0trx.cc:2494
trx_rseg_type_t
Definition: trx0trx.h:678
@ TRX_RSEG_TYPE_NONE
void rollback segment type.
Definition: trx0trx.h:679
@ TRX_RSEG_TYPE_NOREDO
non-redo rollback segment.
Definition: trx0trx.h:681
@ TRX_RSEG_TYPE_REDO
redo rollback segment.
Definition: trx0trx.h:680
void trx_disconnect_prepared(trx_t *trx)
Disconnect a prepared transaction from MySQL.
Definition: trx0trx.cc:678
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 ...
Definition: trx0trx.h:1212
static void assert_trx_is_free(const trx_t *t)
Check if transaction is free so that it can be re-initialized.
Definition: trx0trx.h:1190
commit_node_state
Commit node states.
Definition: trx0trx.h:1338
@ COMMIT_NODE_SEND
about to send a commit signal to the transaction
Definition: trx0trx.h:1339
@ COMMIT_NODE_WAIT
commit signal sent to the transaction, waiting for completion
Definition: trx0trx.h:1341
void trx_commit_or_rollback_prepare(trx_t *trx)
Prepares a transaction for commit/rollback.
Definition: trx0trx.cc:2332
static void trx_start_internal_read_only(trx_t *t, ut::Location loc)
Definition: trx0trx.h:1285
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.
Definition: trx0trx.h:1151
void trx_set_detailed_error(trx_t *trx, const char *msg)
Set detailed error message for the transaction.
Definition: trx0trx.cc:139
void trx_cleanup_at_db_startup(trx_t *trx)
Cleans up a transaction at database startup.
Definition: trx0trx.cc:2278
dberr_t trx_commit_for_mysql(trx_t *trx)
Does the transaction commit for MySQL.
Definition: trx0trx.cc:2439
dberr_t trx_prepare_for_mysql(trx_t *trx)
Does the transaction prepare for MySQL.
Definition: trx0trx.cc:3114
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.
Definition: trx0trx.cc:2544
bool trx_mutex_own(const trx_t *trx)
Test if trx->mutex is owned by the current thread.
Definition: trx0trx.h:1354
void trx_start_if_not_started_xa_low(trx_t *trx, bool read_write)
Starts the transaction if it is not yet started.
Definition: trx0trx.cc:3330
Transaction system global type definitions.
static const uint32_t TRX_FORCE_ROLLBACK_MASK
For masking out the above flags.
Definition: trx0types.h:68
ib_mutex_t TrxMutex
Definition: trx0types.h:171
trx_state_t
Transaction states (trx_t::state)
Definition: trx0types.h:80
@ TRX_STATE_FORCED_ROLLBACK
Same as not started but with additional semantics that it was rolled back asynchronously the last tim...
Definition: trx0types.h:86
@ TRX_STATE_ACTIVE
Definition: trx0types.h:88
@ TRX_STATE_COMMITTED_IN_MEMORY
Definition: trx0types.h:93
@ TRX_STATE_NOT_STARTED
Definition: trx0types.h:82
@ TRX_STATE_PREPARED
Support for 2PC/XA.
Definition: trx0types.h:91
trx_que_t
Transaction execution states when trx->state == TRX_STATE_ACTIVE.
Definition: trx0types.h:71
ib_id_t undo_no_t
Undo number.
Definition: trx0types.h:142
static const uint32_t TRX_FORCE_ROLLBACK
Mark the transaction for forced rollback.
Definition: trx0types.h:65
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
static const uint32_t TRX_FORCE_ROLLBACK_DISABLE
If this flag is set then the transaction cannot be rolled back asynchronously.
Definition: trx0types.h:62
ib_mutex_t UndoMutex
Definition: trx0types.h:172
trx_dict_op_t
Type of data dictionary operation.
Definition: trx0types.h:97
@ TRX_DICT_OP_NONE
The transaction is not modifying the data dictionary.
Definition: trx0types.h:99
unsigned long int ulint
Definition: univ.i:406
long int lint
Definition: univ.i:407
Users and sessions global types.
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_o(EXPR)
Opposite of ut_d().
Definition: ut0dbg.h:109
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:107
#define UT_LIST_GET_LEN(BASE)
Alternative macro to get the number of nodes in a two-way list, i.e., its length.
Definition: ut0lst.h:441
#define UT_LIST_BASE_NODE_T_EXTERN(t, m)
A variant of UT_LIST_BASE_NODE_T to be used in rare cases where the full definition of t is not yet i...
Definition: ut0lst.h:279
#define UT_LIST_NODE_T(t)
Macro used for legacy reasons.
Definition: ut0lst.h:64
#define mutex_own(M)
Checks that the current thread owns the mutex.
Definition: ut0mutex.h:165
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
A vector of pointers to data items.
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:884