MySQL 8.0.40
Source Code Documentation
trx_sys_t Struct Reference

The transaction system central memory data structure. More...

#include <trx0sys.h>

Public Member Functions

Trx_shardget_shard_by_trx_id (trx_id_t trx_id)
 
template<typename F >
auto latch_and_execute_with_active_trx (trx_id_t trx_id, F &&f, const ut::Location &loc)
 

Public Attributes

char pad0 [ut::INNODB_CACHE_LINE_SIZE]
 
char pad1 [ut::INNODB_CACHE_LINE_SIZE]
 
char pad2 [ut::INNODB_CACHE_LINE_SIZE]
 
char pad4 [ut::INNODB_CACHE_LINE_SIZE]
 
char pad_after [ut::INNODB_CACHE_LINE_SIZE]
 
MVCCmvcc
 Multi version concurrency control manager. More...
 
Rsegs rsegs
 Vector of pointers to rollback segments. More...
 
Rsegs tmp_rsegs
 Vector of pointers to rollback segments within the temp tablespace; This vector is created and destroyed in single-threaded mode so it is not protected by any mutex because it is read-only during multi-threaded operation. More...
 
std::atomic< uint64_t > rseg_history_len
 Length of the TRX_RSEG_HISTORY list (update undo logs for committed transactions). More...
 
std::atomic< trx_id_tnext_trx_id_or_no
 The smallest number not yet assigned as a transaction id or transaction number. More...
 
TrxSysMutex serialisation_mutex
 Mutex to protect serialisation_list. More...
 
trx_id_t rw_max_trx_no
 Max trx number of read-write transactions added for purge. More...
 
char pad3 [ut::INNODB_CACHE_LINE_SIZE]
 
std::atomic< trx_id_tserialisation_min_trx_no
 
 UT_LIST_BASE_NODE_T (trx_t, no_list) serialisation_list
 Tracks minimal transaction id which has received trx->no, but has not yet finished commit for the mtr writing the trx commit. More...
 
TrxSysMutex mutex
 Mutex protecting most fields in this structure (the default one). More...
 
char pad5 [ut::INNODB_CACHE_LINE_SIZE]
 
char pad6 [ut::INNODB_CACHE_LINE_SIZE]
 
trx_ids_t rw_trx_ids
 Array of Read write transaction IDs for MVCC snapshot. More...
 
char pad7 [ut::INNODB_CACHE_LINE_SIZE]
 
Trx_shard shards [TRX_SHARDS_N]
 Mapping from transaction id to transaction instance. More...
 
ulint n_prepared_trx
 Number of transactions currently in the XA PREPARED state. More...
 
bool found_prepared_trx
 True if XA PREPARED trxs are found. More...
 
 UT_LIST_BASE_NODE_T (trx_t, trx_list) rw_trx_list
 List of active and committed in memory read-write transactions, sorted on trx id, biggest first. More...
 
 UT_LIST_BASE_NODE_T (trx_t, mysql_trx_list) mysql_trx_list
 List of transactions created for MySQL. More...
 

Detailed Description

The transaction system central memory data structure.

Member Function Documentation

◆ get_shard_by_trx_id()

Trx_shard & trx_sys_t::get_shard_by_trx_id ( trx_id_t  trx_id)
inline

◆ latch_and_execute_with_active_trx()

template<typename F >
auto trx_sys_t::latch_and_execute_with_active_trx ( trx_id_t  trx_id,
F &&  f,
const ut::Location loc 
)
inline

◆ UT_LIST_BASE_NODE_T() [1/3]

trx_sys_t::UT_LIST_BASE_NODE_T ( trx_t  ,
mysql_trx_list   
)

List of transactions created for MySQL.

All user transactions are on mysql_trx_list. The rw_trx_list can contain system transactions and recovered transactions that will not be in the mysql_trx_list. Additionally, mysql_trx_list may contain transactions that have not yet been started in InnoDB.

◆ UT_LIST_BASE_NODE_T() [2/3]

trx_sys_t::UT_LIST_BASE_NODE_T ( trx_t  ,
no_list   
)

Tracks minimal transaction id which has received trx->no, but has not yet finished commit for the mtr writing the trx commit.

Protected by the serialisation_mutex. Ordered on the trx->no field.

◆ UT_LIST_BASE_NODE_T() [3/3]

trx_sys_t::UT_LIST_BASE_NODE_T ( trx_t  ,
trx_list   
)

List of active and committed in memory read-write transactions, sorted on trx id, biggest first.

Recovered transactions are always on this list.

Member Data Documentation

◆ found_prepared_trx

bool trx_sys_t::found_prepared_trx

True if XA PREPARED trxs are found.

◆ mutex

TrxSysMutex trx_sys_t::mutex

Mutex protecting most fields in this structure (the default one).

◆ mvcc

MVCC* trx_sys_t::mvcc

Multi version concurrency control manager.

◆ n_prepared_trx

ulint trx_sys_t::n_prepared_trx

Number of transactions currently in the XA PREPARED state.

◆ next_trx_id_or_no

std::atomic<trx_id_t> trx_sys_t::next_trx_id_or_no

The smallest number not yet assigned as a transaction id or transaction number.

This is declared as atomic because it can be accessed without holding any mutex during AC-NL-RO view creation. When it is used for assignment of the trx->id, it is synchronized by the trx_sys_t::mutex. When it is used for assignment of the trx->no, it is synchronized by the trx_sys_t::serialisation_mutex. Note: it might be in parallel used for both trx->id and trx->no assignments (for different trx_t objects).

◆ pad0

char trx_sys_t::pad0[ut::INNODB_CACHE_LINE_SIZE]

◆ pad1

char trx_sys_t::pad1[ut::INNODB_CACHE_LINE_SIZE]

◆ pad2

char trx_sys_t::pad2[ut::INNODB_CACHE_LINE_SIZE]

◆ pad3

char trx_sys_t::pad3[ut::INNODB_CACHE_LINE_SIZE]

◆ pad4

char trx_sys_t::pad4[ut::INNODB_CACHE_LINE_SIZE]

◆ pad5

char trx_sys_t::pad5[ut::INNODB_CACHE_LINE_SIZE]

◆ pad6

char trx_sys_t::pad6[ut::INNODB_CACHE_LINE_SIZE]

◆ pad7

char trx_sys_t::pad7[ut::INNODB_CACHE_LINE_SIZE]

◆ pad_after

char trx_sys_t::pad_after[ut::INNODB_CACHE_LINE_SIZE]

◆ rseg_history_len

std::atomic<uint64_t> trx_sys_t::rseg_history_len

Length of the TRX_RSEG_HISTORY list (update undo logs for committed transactions).

◆ rsegs

Rsegs trx_sys_t::rsegs

Vector of pointers to rollback segments.

These rsegs are iterated and added to the end under a read lock. They are deleted under a write lock while the vector is adjusted. They are created and destroyed in single-threaded mode.

◆ rw_max_trx_no

trx_id_t trx_sys_t::rw_max_trx_no

Max trx number of read-write transactions added for purge.

◆ rw_trx_ids

trx_ids_t trx_sys_t::rw_trx_ids

Array of Read write transaction IDs for MVCC snapshot.

A ReadView would take a snapshot of these transactions whose changes are not visible to it. We should remove transactions from the list before committing in memory and releasing locks to ensure right order of removal and consistent snapshot.

◆ serialisation_min_trx_no

std::atomic<trx_id_t> trx_sys_t::serialisation_min_trx_no

◆ serialisation_mutex

TrxSysMutex trx_sys_t::serialisation_mutex

Mutex to protect serialisation_list.

◆ shards

Trx_shard trx_sys_t::shards[TRX_SHARDS_N]

Mapping from transaction id to transaction instance.

◆ tmp_rsegs

Rsegs trx_sys_t::tmp_rsegs

Vector of pointers to rollback segments within the temp tablespace; This vector is created and destroyed in single-threaded mode so it is not protected by any mutex because it is read-only during multi-threaded operation.


The documentation for this struct was generated from the following file: