MySQL  8.0.12
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 segements from a given transaction with trx-no scheduled for purge. More...
 
struct  TrxTrack
 Mapping read-write transactions from id to transaction instance, for creating read views and during trx id lookup for MVCC and locking. More...
 
struct  TrxTrackHash
 
struct  TrxTrackHashCmp
 Comparator for TrxMap. More...
 
struct  TrxTrackCmp
 Comparator for TrxMap. More...
 

Macros

#define TRX_ID_FMT   IB_ID_FMT
 printf(3) format used for printing DB_TRX_ID and other system fields More...
 
#define TRX_SYS_PAGE_NO   FSP_TRX_SYS_PAGE_NO
 Page number of the transaction system page. More...
 
#define TRX_ID_MAX   IB_ID_MAX
 Maximum transaction identifier. 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
 
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::set< TrxTrack, TrxTrackCmp, ut_allocator< TrxTrack > > TrxIdSet
 
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...
 

Variables

static const ulint TRX_ID_MAX_LEN = 17
 maximum length that a formatted trx_t::id could take, not including the terminating NUL character. More...
 
static const space_id_t TRX_SYS_SPACE = 0
 Space id of the transaction system page (the system tablespace) More...
 
static const ulint TRX_MAGIC_N = 91118598
 Random value to check for corruption of trx_t. More...
 
static const ib_uint32_t TRX_FORCE_ROLLBACK_DISABLE = 1 << 29
 If this flag is set then the transaction cannot be rolled back asynchronously. More...
 
static const ib_uint32_t TRX_FORCE_ROLLBACK_ASYNC = 1 << 30
 Was the transaction rolled back asynchronously or by the owning thread. More...
 
static const ib_uint32_t TRX_FORCE_ROLLBACK = 1 << 31
 Mark the transaction for forced rollback. More...
 
static const ib_uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF
 For masking out the above four flags. 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

◆ TRX_ID_MAX

#define TRX_ID_MAX   IB_ID_MAX

Maximum transaction identifier.

◆ TRX_SYS_PAGE_NO

#define TRX_SYS_PAGE_NO   FSP_TRX_SYS_PAGE_NO

Page number of the transaction system page.

Typedef Documentation

◆ 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

typedef ib_id_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_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.

◆ TrxIdSet

◆ 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 

Variable Documentation

◆ TRX_FORCE_ROLLBACK

const ib_uint32_t TRX_FORCE_ROLLBACK = 1 << 31
static

Mark the transaction for forced rollback.

◆ TRX_FORCE_ROLLBACK_ASYNC

const ib_uint32_t TRX_FORCE_ROLLBACK_ASYNC = 1 << 30
static

Was the transaction rolled back asynchronously or by the owning thread.

This flag is relevant only if TRX_FORCE_ROLLBACK is set.

◆ TRX_FORCE_ROLLBACK_DISABLE

const ib_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 ib_uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF
static

For masking out the above four flags.

◆ TRX_ID_MAX_LEN

const ulint TRX_ID_MAX_LEN = 17
static

maximum length that a formatted trx_t::id could take, not including the terminating NUL character.

◆ TRX_MAGIC_N

const ulint TRX_MAGIC_N = 91118598
static

Random value to check for corruption of trx_t.

◆ TRX_SYS_SPACE

const space_id_t TRX_SYS_SPACE = 0
static

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