MySQL 9.0.0
Source Code Documentation
trx0types.h File Reference

Transaction system global type definitions. More...

#include "page0size.h"
#include "sync0rw.h"
#include "ut0byte.h"
#include "ut0mutex.h"
#include "ut0new.h"
#include <atomic>
#include <queue>
#include <set>
#include <vector>

Go to the source code of this file.

Classes

struct  trx_savept_t
 Transaction savepoint. More...
 
struct  trx_rseg_t
 The rollback segment memory object. More...
 
class  Rsegs
 This is a wrapper for a std::vector of trx_rseg_t object pointers. More...
 
class  TrxUndoRsegs
 Rollback segments from a given transaction with trx-no scheduled for purge. More...
 
struct  TrxVersion
 

Macros

#define TRX_ID_FMT   IB_ID_FMT
 printf(3) format used for printing DB_TRX_ID and other system fields More...
 

Typedefs

typedef ib_id_t row_id_t
 Row identifier (DB_ROW_ID, DATA_ROW_ID) More...
 
typedef ib_id_t trx_id_t
 Transaction identifier (DB_TRX_ID, DATA_TRX_ID) More...
 
typedef ib_id_t roll_ptr_t
 Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR) More...
 
typedef ib_id_t undo_no_t
 Undo number. More...
 
typedef ib_mutex_t RsegMutex
 
typedef ib_mutex_t TrxMutex
 
typedef ib_mutex_t UndoMutex
 
typedef ib_mutex_t PQMutex
 
typedef ib_mutex_t TrxSysMutex
 
using Rsegs_Vector = std::vector< trx_rseg_t *, ut::allocator< trx_rseg_t * > >
 
using Rseg_Iterator = Rsegs_Vector::iterator
 
template<size_t N>
using Rsegs_array = std::array< trx_rseg_t *, N >
 
typedef std::priority_queue< TrxUndoRsegs, std::vector< TrxUndoRsegs, ut::allocator< TrxUndoRsegs > >, TrxUndoRsegspurge_pq_t
 
typedef std::vector< trx_id_t, ut::allocator< trx_id_t > > trx_ids_t
 
typedef std::vector< TrxVersion, ut::allocator< TrxVersion > > hit_list_t
 
typedef byte trx_sysf_t
 File objects. More...
 
typedef byte trx_rsegsf_t
 Rollback segment array header. More...
 
typedef byte trx_rsegf_t
 Rollback segment header. More...
 
typedef byte trx_usegf_t
 Undo segment header. More...
 
typedef byte trx_ulogf_t
 Undo log header. More...
 
typedef byte trx_upagef_t
 Undo log page header. More...
 
typedef byte trx_undo_rec_t
 Undo log record. More...
 

Enumerations

enum  trx_que_t { TRX_QUE_RUNNING , TRX_QUE_LOCK_WAIT , TRX_QUE_ROLLING_BACK , TRX_QUE_COMMITTING }
 Transaction execution states when trx->state == TRX_STATE_ACTIVE. More...
 
enum  trx_state_t {
  TRX_STATE_NOT_STARTED , TRX_STATE_FORCED_ROLLBACK , TRX_STATE_ACTIVE , TRX_STATE_PREPARED ,
  TRX_STATE_COMMITTED_IN_MEMORY
}
 Transaction states (trx_t::state) More...
 
enum  trx_dict_op_t { TRX_DICT_OP_NONE = 0 , TRX_DICT_OP_TABLE = 1 , TRX_DICT_OP_INDEX = 2 }
 Type of data dictionary operation. More...
 

Functions

std::ostream & operator<< (std::ostream &out, const trx_rseg_t &rseg)
 

Variables

static const space_id_t TRX_SYS_SPACE = 0
 Space id of the transaction system page (the system tablespace) More...
 
constexpr uint32_t TRX_SYS_PAGE_NO = FSP_TRX_SYS_PAGE_NO
 Page number of the transaction system page. More...
 
static const ulint TRX_MAGIC_N = 91118598
 Random value to check for corruption of trx_t. More...
 
static const uint32_t TRX_FORCE_ROLLBACK_DISABLE = 1 << 29
 If this flag is set then the transaction cannot be rolled back asynchronously. More...
 
static const uint32_t TRX_FORCE_ROLLBACK = 1U << 31
 Mark the transaction for forced rollback. More...
 
static const uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF
 For masking out the above flags. More...
 
constexpr trx_id_t TRX_ID_MAX = IB_ID_MAX
 Maximum transaction identifier. More...
 

Detailed Description

Transaction system global type definitions.

Created 3/26/1996 Heikki Tuuri

Macro Definition Documentation

◆ TRX_ID_FMT

#define TRX_ID_FMT   IB_ID_FMT

printf(3) format used for printing DB_TRX_ID and other system fields

Typedef Documentation

◆ hit_list_t

typedef std::vector<TrxVersion, ut::allocator<TrxVersion> > hit_list_t

◆ PQMutex

typedef ib_mutex_t PQMutex

◆ purge_pq_t

typedef std::priority_queue< TrxUndoRsegs, std::vector<TrxUndoRsegs, ut::allocator<TrxUndoRsegs> >, TrxUndoRsegs> purge_pq_t

◆ roll_ptr_t

Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR)

◆ row_id_t

typedef ib_id_t row_id_t

Row identifier (DB_ROW_ID, DATA_ROW_ID)

◆ Rseg_Iterator

using Rseg_Iterator = Rsegs_Vector::iterator

◆ RsegMutex

typedef ib_mutex_t RsegMutex

◆ Rsegs_array

template<size_t N>
using Rsegs_array = std::array<trx_rseg_t *, N>

◆ Rsegs_Vector

using Rsegs_Vector = std::vector<trx_rseg_t *, ut::allocator<trx_rseg_t *> >

◆ trx_id_t

typedef ib_id_t trx_id_t

Transaction identifier (DB_TRX_ID, DATA_TRX_ID)

◆ trx_ids_t

typedef std::vector<trx_id_t, ut::allocator<trx_id_t> > trx_ids_t

◆ trx_rsegf_t

typedef byte trx_rsegf_t

Rollback segment header.

◆ trx_rsegsf_t

typedef byte trx_rsegsf_t

Rollback segment array header.

◆ trx_sysf_t

typedef byte trx_sysf_t

File objects.

Transaction system header

◆ trx_ulogf_t

typedef byte trx_ulogf_t

Undo log header.

◆ trx_undo_rec_t

Undo log record.

◆ trx_upagef_t

typedef byte trx_upagef_t

Undo log page header.

◆ trx_usegf_t

typedef byte trx_usegf_t

Undo segment header.

◆ TrxMutex

typedef ib_mutex_t TrxMutex

◆ TrxSysMutex

typedef ib_mutex_t TrxSysMutex

◆ undo_no_t

typedef ib_id_t undo_no_t

Undo number.

◆ UndoMutex

typedef ib_mutex_t UndoMutex

Enumeration Type Documentation

◆ trx_dict_op_t

Type of data dictionary operation.

Enumerator
TRX_DICT_OP_NONE 

The transaction is not modifying the data dictionary.

TRX_DICT_OP_TABLE 

The transaction is creating a table or an index, or dropping a table.

The table must be dropped in crash recovery. This and TRX_DICT_OP_NONE are the only possible operation modes in crash recovery.

TRX_DICT_OP_INDEX 

The transaction is creating or dropping an index in an existing table.

In crash recovery, the data dictionary must be locked, but the table must not be dropped.

◆ trx_que_t

enum trx_que_t

Transaction execution states when trx->state == TRX_STATE_ACTIVE.

Enumerator
TRX_QUE_RUNNING 

transaction is running

TRX_QUE_LOCK_WAIT 

transaction is waiting for a lock

TRX_QUE_ROLLING_BACK 

transaction is rolling back

TRX_QUE_COMMITTING 

transaction is committing

◆ trx_state_t

Transaction states (trx_t::state)

Enumerator
TRX_STATE_NOT_STARTED 
TRX_STATE_FORCED_ROLLBACK 

Same as not started but with additional semantics that it was rolled back asynchronously the last time it was active.

TRX_STATE_ACTIVE 
TRX_STATE_PREPARED 

Support for 2PC/XA.

TRX_STATE_COMMITTED_IN_MEMORY 

Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const trx_rseg_t rseg 
)
inline

Variable Documentation

◆ TRX_FORCE_ROLLBACK

const uint32_t TRX_FORCE_ROLLBACK = 1U << 31
static

Mark the transaction for forced rollback.

◆ TRX_FORCE_ROLLBACK_DISABLE

const uint32_t TRX_FORCE_ROLLBACK_DISABLE = 1 << 29
static

If this flag is set then the transaction cannot be rolled back asynchronously.

◆ TRX_FORCE_ROLLBACK_MASK

const uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF
static

For masking out the above flags.

◆ TRX_ID_MAX

constexpr trx_id_t TRX_ID_MAX = IB_ID_MAX
constexpr

Maximum transaction identifier.

◆ TRX_MAGIC_N

const ulint TRX_MAGIC_N = 91118598
static

Random value to check for corruption of trx_t.

◆ TRX_SYS_PAGE_NO

constexpr uint32_t TRX_SYS_PAGE_NO = FSP_TRX_SYS_PAGE_NO
constexpr

Page number of the transaction system page.

◆ TRX_SYS_SPACE

const space_id_t TRX_SYS_SPACE = 0
static

Space id of the transaction system page (the system tablespace)