358 const trx_t *holder);
377typedef std::vector<ib_lock_t *, ut::allocator<ib_lock_t *>>
lock_pool_t;
584typedef std::set<dict_table_t *, std::less<dict_table_t *>,
926 std::chrono::system_clock::time_point{}};
927 static_assert(
decltype(
start_time)::is_always_lock_free);
1038#ifndef UNIV_HOTBACKUP
1123 ut_o(
return (
false));
1134#ifndef UNIV_HOTBACKUP
1220#define assert_trx_nonlocking_or_in_list(trx) ((void)0)
1301#define TRX_ISO_READ_UNCOMMITTED trx_t::READ_UNCOMMITTED
1302#define TRX_ISO_READ_COMMITTED trx_t::READ_COMMITTED
1303#define TRX_ISO_REPEATABLE_READ trx_t::REPEATABLE_READ
1304#define TRX_ISO_SERIALIZABLE trx_t::SERIALIZABLE
1314 const auto trx_state = trx->
state.load(std::memory_order_relaxed);
1374#define trx_mutex_enter_low(t, first_of_two) \
1376 ut_ad(!trx_mutex_own(t)); \
1377 ut_d(trx_before_mutex_enter(t, first_of_two)); \
1378 mutex_enter(&t->mutex); \
1382#define trx_mutex_enter(t) trx_mutex_enter_low(t, false)
1385#define trx_mutex_enter_first_of_two(t) trx_mutex_enter_low(t, true)
1388#define trx_mutex_exit(t) \
1390 ut_ad(trx_mutex_own(t)); \
1391 ut_d(trx_before_mutex_exit(t)); \
1392 mutex_exit(&t->mutex); \
1403 enter(trx, disable);
1427 const auto trx_state = trx->
state.load(std::memory_order_relaxed);
1545 ulint loop_count = 0;
1547 ulint sleep_time = 20;
1556 if (loop_count < 100) {
1559 }
else if (loop_count < 1000) {
1564 sleep_time = 100000;
1567 std::this_thread::sleep_for(std::chrono::microseconds(sleep_time));
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
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:1397
static void begin_stmt(trx_t *trx)
Start statement requested for transaction.
Definition: trx0trx.h:1442
static void end_stmt(trx_t *trx)
Note an end statement for transaction.
Definition: trx0trx.h:1447
static void enter(trx_t *trx, bool disable)
Note that we have crossed into InnoDB code.
Definition: trx0trx.h:1460
static void wait(const trx_t *trx)
Wait for the asynchronous rollback to complete, if it is in progress.
Definition: trx0trx.h:1542
static bool is_aborted(const trx_t *trx)
Definition: trx0trx.h:1424
~TrxInInnoDB()
Destructor.
Definition: trx0trx.h:1408
static bool is_forced_rollback(const trx_t *trx)
Definition: trx0trx.h:1534
static bool is_async_rollback(const trx_t *trx)
Definition: trx0trx.h:1452
bool is_aborted() const
Definition: trx0trx.h:1413
static bool is_started(const trx_t *trx)
Definition: trx0trx.h:1576
static void exit(trx_t *trx)
Note that we are exiting InnoDB code.
Definition: trx0trx.h:1508
bool is_rollback_disabled() const
Definition: trx0trx.h:1417
trx_t * m_trx
Transaction instance crossing the handler boundary from the Server.
Definition: trx0trx.h:1584
TrxInInnoDB(trx_t *trx, bool disable=false)
Definition: trx0trx.h:1402
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:2182
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:1957
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:1337
enum commit_node_state state
node execution state
Definition: trx0trx.h:1339
que_common_t common
node type: QUE_NODE_COMMIT
Definition: trx0trx.h:1338
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:401
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:558
trx_lock_t()=default
Default constructor.
std::atomic< ulint > n_rec_locks
Number of rec locks in this trx.
Definition: trx0trx.h:549
mem_heap_t * lock_heap
Memory heap for trx_locks.
Definition: trx0trx.h:524
bool start_stmt
The transaction called ha_innobase::start_stmt() to lock a table.
Definition: trx0trx.h:577
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:439
trx_lock_list_t trx_locks
Locks requested by the transaction.
Definition: trx0trx.h:538
std::atomic< lock_t * > wait_lock
The lock request of this transaction is waiting for.
Definition: trx0trx.h:460
std::chrono::system_clock::time_point wait_started
Lock wait started at this time.
Definition: trx0trx.h:501
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:415
trx_que_t que_state
valid when trx->state == TRX_STATE_ACTIVE: TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, ...
Definition: trx0trx.h:407
bool in_rollback
When a transaction is forced to rollback due to a deadlock check or by another high priority transact...
Definition: trx0trx.h:572
lock_pool_t table_pool
Pre-allocated table locks.
Definition: trx0trx.h:515
ulint rec_cached
Next free record lock in pool.
Definition: trx0trx.h:518
ulint n_active_thrs
number of active query threads
Definition: trx0trx.h:405
std::atomic< trx_schedule_weight_t > schedule_weight
Weight of the waiting transaction used for scheduling.
Definition: trx0trx.h:566
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:490
ib_vector_t * autoinc_locks
AUTOINC locks held by this transaction.
Definition: trx0trx.h:544
uint32_t wait_lock_type
Stores the type of the most recent lock for which this trx had to wait.
Definition: trx0trx.h:488
lock_pool_t rec_pool
Pre-allocated record locks.
Definition: trx0trx.h:512
ulint table_cached
Next free table lock in pool.
Definition: trx0trx.h:521
que_thr_t * wait_thr
query thread belonging to this trx that is in QUE_THR_LOCK_WAIT state.
Definition: trx0trx.h:509
A savepoint set with SQL's "SAVEPOINT savepoint_id" command.
Definition: trx0roll.h:168
The rollback segment memory object.
Definition: trx0types.h:214
Rollback segments assigned to a transaction for undo logging.
Definition: trx0trx.h:657
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:666
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:661
Transaction savepoint.
Definition: trx0types.h:148
Definition: trx0trx.h:675
const char * op_info
English text describing the current operation, or an empty string.
Definition: trx0trx.h:851
bool releases_gap_locks_at_prepare() const
Definition: trx0trx.h:1109
space_id_t undo_rseg_space
space id where last undo record was written
Definition: trx0trx.h:1004
bool is_recovered
false: a normal transaction true: a recovered transaction
Definition: trx0trx.h:835
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:918
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:945
char * detailed_error
detailed error message for last error, or empty.
Definition: trx0trx.h:1094
bool allow_semi_consistent() const
Definition: trx0trx.h:1126
ulint magic_n
Definition: trx0trx.h:1103
ulint n_autoinc_rows
no.
Definition: trx0trx.h:1022
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:886
bool flush_log_later
Definition: trx0trx.h:880
no_list
Required during view creation to check for the view limit for transactions that are committing.
Definition: trx0trx.h:816
trx_dict_op_t dict_operation
Definition: trx0trx.h:899
THD * mysql_thd
MySQL thread handle corresponding to this trx, or NULL.
Definition: trx0trx.h:932
XID * xid
X/Open XA transaction identification to identify a transaction branch.
Definition: trx0trx.h:1076
fts_trx_t * fts_trx
FTS information, or NULL if transaction hasn't modified tables with FTS indexes (yet).
Definition: trx0trx.h:1040
undo_no_t undo_no
next undo log record number to assign; since the undo log is private for a transaction,...
Definition: trx0trx.h:997
bool releases_non_matching_rows() const
Checks if this transaction releases locks on non matching records due to low isolation level.
Definition: trx0trx.h:1131
uint32_t will_lock
Will acquire some locks.
Definition: trx0trx.h:1035
ulint start_line
Track where it was started from.
Definition: trx0trx.h:1058
que_t * graph
query currently run in the session, or NULL if none; NOTE that the query belongs to the session,...
Definition: trx0trx.h:981
std::atomic< std::chrono::system_clock::time_point > start_time
Time the state last time became TRX_STATE_ACTIVE.
Definition: trx0trx.h:925
Flush_observer * flush_observer
flush observer
Definition: trx0trx.h:1096
TrxMutex mutex
Mutex protecting the fields state and lock (except some fields of lock, which are protected by lock_s...
Definition: trx0trx.h:706
doc_id_t fts_next_doc_id
Definition: trx0trx.h:1043
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:935
lint n_ref
Count of references, protected by trx_t::mutex.
Definition: trx0trx.h:1062
uint32_t in_innodb
if the thread is executing in the InnoDB context count > 0.
Definition: trx0trx.h:720
std::atomic_uint64_t version
Version of this instance.
Definition: trx0trx.h:1074
bool auto_commit
true if it is an autocommit
Definition: trx0trx.h:1034
bool is_dd_trx
True if the transaction is used for doing Non-locking Read-only Read Committed on DD tables.
Definition: trx0trx.h:1099
uint32_t flush_tables
if "covering" the FLUSH TABLES", count of tables being flushed.
Definition: trx0trx.h:1045
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:800
isolation_level_t isolation_level
Current isolation level.
Definition: trx0trx.h:856
bool in_mysql_trx_list
true if in trx_sys->mysql_trx_list
Definition: trx0trx.h:962
bool api_auto_commit
automatic commit
Definition: trx0trx.h:1084
uint32_t in_depth
Track nested TrxInInnoDB count.
Definition: trx0trx.h:717
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:913
bool skip_lock_inheritance
Definition: trx0trx.h:807
ulint pages_undone
number of undo log pages undone since the last undo log truncation
Definition: trx0trx.h:1019
bool ddl_must_flush
True if this trx involves dd table change, and must flush.
Definition: trx0trx.h:903
undo_no_t roll_limit
least undo number to undo during a partial rollback; 0 otherwise
Definition: trx0trx.h:1013
trx_rsegs_t rsegs
Definition: trx0trx.h:1012
bool is_registered
Definition: trx0trx.h:867
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:940
const char * start_file
Filename where it was started.
Definition: trx0trx.h:1059
lsn_t commit_lsn
lsn at the time of the commit
Definition: trx0trx.h:927
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:873
isolation_level_t
Definition: trx0trx.h:676
@ REPEATABLE_READ
this is the default; all consistent reads in the same trx read the same snapshot; full next-key locki...
Definition: trx0trx.h:694
@ READ_COMMITTED
somewhat Oracle-like isolation, except that in range UPDATE and DELETE we must block phantom rows wit...
Definition: trx0trx.h:689
@ SERIALIZABLE
all plain SELECTs are converted to LOCK IN SHARE MODE reads
Definition: trx0trx.h:698
@ READ_UNCOMMITTED
dirty read: non-locking SELECTs are performed so that we do not look at a possible earlier version of...
Definition: trx0trx.h:682
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:974
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:1007
bool is_read_uncommitted() const
Definition: trx0trx.h:1105
bool purge_sys_trx
This flag is set for trx_t objects used by the purge sys.
Definition: trx0trx.h:1092
trx_id_t id
transaction id
Definition: trx0trx.h:727
bool read_only
true if transaction is flagged as a READ-ONLY transaction.
Definition: trx0trx.h:1026
trx_savepoints
savepoints set with SAVEPOINT ..., oldest first
Definition: trx0trx.h:989
bool in_rw_trx_list
True iff in trx_sys->rw_trx_list.
Definition: trx0trx.h:955
bool api_trx
trx started by InnoDB API
Definition: trx0trx.h:1083
bool skip_gap_locks() const
Definition: trx0trx.h:1113
bool abort
if this flag is set then this transaction must abort when it can
Definition: trx0trx.h:723
bool in_truncate
Definition: trx0trx.h:905
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:908
std::atomic< std::thread::id > killed_by
The thread ID that wants to kill this transaction asynchronously.
Definition: trx0trx.h:837
bool check_foreigns
normally true, but if the user wants to suppress foreign key checks, (in table imports,...
Definition: trx0trx.h:858
bool persists_gtid
Transaction persists GTID.
Definition: trx0trx.h:1055
dberr_t error_state
DB_SUCCESS if no error, otherwise error number.
Definition: trx0trx.h:972
trx_list
list of transactions; protected by trx_sys->mutex.
Definition: trx0trx.h:813
trx_id_t no
transaction serialization number: max trx id shortly before the transaction is moved to COMMITTED_IN_...
Definition: trx0trx.h:729
ReadView * read_view
consistent read view used in the transaction, or NULL if not yet set
Definition: trx0trx.h:809
sess_t * sess
session of the trx, NULL if none
Definition: trx0trx.h:980
bool in_rollback
true when the transaction is executing a partial or full rollback
Definition: trx0trx.h:1016
bool read_write
if read and write operation
Definition: trx0trx.h:1085
UndoMutex undo_mutex
mutex protecting the fields in this section (down to undo_no_arr), EXCEPT last_sql_stat_start,...
Definition: trx0trx.h:991
bool has_search_latch
true if this trx has latched the search system latch in S-mode.
Definition: trx0trx.h:892
trx_lock_t lock
Information about the transaction locks and state.
Definition: trx0trx.h:822
trx_mod_tables_t mod_tables
List of tables that were modified by this transaction.
Definition: trx0trx.h:1079
bool ddl_operation
True if this trx involves dd table change.
Definition: trx0trx.h:901
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:977
uint32_t mysql_n_tables_locked
how many tables the current SQL statement uses, except those in consistent read
Definition: trx0trx.h:948
mysql_trx_list
list of transactions created for MySQL; protected by trx_sys->mutex
Definition: trx0trx.h:959
The transaction handle.
Definition: trx0trx.h:635
bool is_update()
Definition: trx0trx.h:645
bool is_insert_only()
Definition: trx0trx.h:640
trx_undo_t * insert_undo
pointer to the insert undo log, or NULL if no inserts performed yet
Definition: trx0trx.h:650
trx_undo_t * update_undo
pointer to the update undo log, or NULL if no update performed yet
Definition: trx0trx.h:652
trx_rseg_t * rseg
rollback segment assigned to the transaction, or NULL if not assigned yet
Definition: trx0trx.h:647
bool is_empty()
Definition: trx0trx.h:637
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
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:3366
bool trx_assert_started(const trx_t *trx)
Asserts that a transaction has been started.
Definition: trx0trx.cc:2702
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:3125
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:1194
bool trx_is_started(const trx_t *trx)
Check if transaction is started.
Definition: trx0trx.h:1323
static void trx_start_internal(trx_t *t, ut::Location loc)
Definition: trx0trx.h:1270
bool trx_was_started(const trx_t *trx)
Check if transaction was started.
Definition: trx0trx.h:1313
void trx_free_prepared_or_active_recovered(trx_t *trx)
At shutdown, frees a transaction object that represents either:
Definition: trx0trx.cc:601
void trx_free_for_background(trx_t *trx)
Free a transaction that was allocated by background or user threads.
Definition: trx0trx.cc:595
trx_t * trx_allocate_for_background(void)
Creates a transaction object for background operations by the master thread.
Definition: trx0trx.cc:524
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:2397
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:2885
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:586
void trx_pool_init()
Create the trx_t pool.
Definition: trx0trx.cc:432
void trx_free_for_mysql(trx_t *trx)
Free a transaction object for MySQL.
Definition: trx0trx.cc:688
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:1228
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:3465
static void trx_start_if_not_started_xa(trx_t *t, bool rw, ut::Location loc)
Definition: trx0trx.h:1257
void trx_disconnect_plain(trx_t *trx)
Disconnect a transaction from MySQL.
Definition: trx0trx.cc:676
bool trx_weight_ge(const trx_t *a, const trx_t *b)
Compares the "weight" (or size) of two transactions.
Definition: trx0trx.cc:2899
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:776
void trx_free_resurrected(trx_t *trx)
Free and initialize a transaction object instantiated during recovery.
Definition: trx0trx.cc:585
void trx_clear_resurrected_table_ids()
Clear all resurrected table IDs.
Definition: trx0trx.cc:830
void trx_print_latched(FILE *f, const trx_t *trx, ulint max_query_len)
Prints info about a transaction.
Definition: trx0trx.cc:2662
void trx_sys_update_binlog_position(trx_t *trx)
Update transaction binlog file name and position from session THD.
Definition: trx0trx.cc:3624
static void check_trx_state(const trx_t *t)
Check transaction state.
Definition: trx0trx.h:1156
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:3252
static void trx_start_if_not_started(trx_t *t, bool rw, ut::Location l)
Definition: trx0trx.h:1264
void trx_mark_sql_stat_end(trx_t *trx)
Marks the latest SQL statement ended.
Definition: trx0trx.cc:2516
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:2257
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:2858
static uint64_t TRX_WEIGHT(const trx_t *t)
Calculates the "weight" of a transaction.
Definition: trx0trx.h:1252
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:3422
std::vector< ib_lock_t *, ut::allocator< ib_lock_t * > > lock_pool_t
Definition: trx0trx.h:377
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:1246
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:2694
ReadView * trx_assign_read_view(trx_t *trx)
Assigns a read view for a consistent read query.
Definition: trx0trx.cc:2319
void trx_assign_rseg_temp(trx_t *trx)
Assign a temp-tablespace bound rollback-segment to a transaction.
Definition: trx0trx.cc:1283
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:2383
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:2682
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:3638
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:1388
void trx_start_internal_read_only_low(trx_t *trx)
Starts a read-only transaction for internal processing.
Definition: trx0trx.cc:3405
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:2165
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:2982
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:3196
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:3313
#define trx_mutex_enter(t)
Acquire the trx->mutex (and promise not to request any more).
Definition: trx0trx.h:1382
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:1151
void trx_pool_close()
Destroy the trx_t pool.
Definition: trx0trx.cc:440
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:3132
void trx_print(FILE *f, const trx_t *trx, ulint max_query_len)
Prints info about a transaction.
Definition: trx0trx.cc:2673
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:1173
void trx_start_internal_low(trx_t *trx)
Starts a transaction for internal processing.
Definition: trx0trx.cc:3391
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:3653
trx_t * trx_allocate_for_mysql(void)
Creates a transaction object for MySQL.
Definition: trx0trx.cc:536
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:1085
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:2498
trx_rseg_type_t
Definition: trx0trx.h:669
@ TRX_RSEG_TYPE_NONE
void rollback segment type.
Definition: trx0trx.h:670
@ TRX_RSEG_TYPE_NOREDO
non-redo rollback segment.
Definition: trx0trx.h:672
@ TRX_RSEG_TYPE_REDO
redo rollback segment.
Definition: trx0trx.h:671
void trx_disconnect_prepared(trx_t *trx)
Disconnect a prepared transaction from MySQL.
Definition: trx0trx.cc:682
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:1203
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:1181
commit_node_state
Commit node states.
Definition: trx0trx.h:1329
@ COMMIT_NODE_SEND
about to send a commit signal to the transaction
Definition: trx0trx.h:1330
@ COMMIT_NODE_WAIT
commit signal sent to the transaction, waiting for completion
Definition: trx0trx.h:1332
void trx_commit_or_rollback_prepare(trx_t *trx)
Prepares a transaction for commit/rollback.
Definition: trx0trx.cc:2336
static void trx_start_internal_read_only(trx_t *t, ut::Location loc)
Definition: trx0trx.h:1276
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:1142
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:2282
dberr_t trx_commit_for_mysql(trx_t *trx)
Does the transaction commit for MySQL.
Definition: trx0trx.cc:2443
dberr_t trx_prepare_for_mysql(trx_t *trx)
Does the transaction prepare for MySQL.
Definition: trx0trx.cc:3118
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:2548
bool trx_mutex_own(const trx_t *trx)
Test if trx->mutex is owned by the current thread.
Definition: trx0trx.h:1345
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:3334
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:885