MySQL 8.0.31
Source Code Documentation
trx0sys.h File Reference

Transaction system. More...

#include "univ.i"
#include "buf0buf.h"
#include "fil0fil.h"
#include "trx0types.h"
#include "mem0mem.h"
#include "mtr0mtr.h"
#include "page0types.h"
#include "ut0byte.h"
#include "ut0class_life_cycle.h"
#include "ut0guarded.h"
#include "ut0lst.h"
#include "ut0mutex.h"
#include <atomic>
#include <unordered_map>
#include <vector>
#include "trx0trx.h"
#include "trx0sys.ic"

Go to the source code of this file.

Classes

class  Space_Ids
 List of undo tablespace IDs. More...
 
class  Trx_by_id_with_min
 
struct  Trx_by_id_with_min::Trx_track_hash
 
struct  Trx_shard
 Shard for subset of transactions. More...
 
struct  trx_sys_t
 The transaction system central memory data structure. More...
 

Macros

#define TRX_SYS_MYSQL_LOG_INFO   (UNIV_PAGE_SIZE - 1000)
 The offset of the MySQL binlog offset info in the trx system header. More...
 
#define TRX_SYS_TRX_NUM_GTID    (TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME + TRX_SYS_MYSQL_LOG_NAME_LEN)
 Reserve next 8 bytes for transaction number up to which GTIDs are persisted to table. More...
 
#define TRX_SYS_TRX_NUM_END   (TRX_SYS_TRX_NUM_GTID + 8)
 

Functions

static bool trx_sys_hdr_page (const page_id_t &page_id)
 Checks if a page address is the trx sys header page. More...
 
purge_pq_ttrx_sys_init_at_db_start (void)
 Creates and initializes the central memory structures for the transaction system. More...
 
void trx_sys_create (void)
 Creates the trx_sys instance and initializes purge_queue and mutex. More...
 
void trx_sys_create_sys_pages (void)
 Creates and initializes the transaction system at the database creation. More...
 
page_no_t trx_sysf_rseg_find_page_no (ulint rseg_id)
 Find the page number in the TRX_SYS page for a given slot/rseg_id. More...
 
ulint trx_sysf_rseg_find_free (mtr_t *mtr)
 Look for a free slot for a rollback segment in the trx system file copy. More...
 
static trx_sysf_ttrx_sysf_get (mtr_t *mtr)
 Gets a pointer to the transaction system file copy and x-locks its page. More...
 
static space_id_t trx_sysf_rseg_get_space (trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
 Gets the space of the nth rollback segment slot in the trx system file copy. More...
 
static page_no_t trx_sysf_rseg_get_page_no (trx_sysf_t *sys_header, ulint i, mtr_t *mtr)
 Gets the page number of the nth rollback segment slot in the trx system file copy. More...
 
static void trx_sysf_rseg_set_space (trx_sysf_t *sys_header, ulint i, space_id_t space, mtr_t *mtr)
 Sets the space id of the nth rollback segment slot in the trx system file copy. More...
 
static void trx_sysf_rseg_set_page_no (trx_sysf_t *sys_header, ulint i, page_no_t page_no, mtr_t *mtr)
 Set the page number of the nth rollback segment slot in the trx system file copy. More...
 
trx_id_t trx_sys_allocate_trx_id ()
 Allocates a new transaction id (for trx->id). More...
 
trx_id_t trx_sys_allocate_trx_no ()
 Allocates a new transaction number (for trx->no). More...
 
trx_id_t trx_sys_get_next_trx_id_or_no ()
 Retrieves a next value that will be allocated if trx_sys_allocate_trx_id() or trx_sys_allocate_trx_id_trx_no() was called. More...
 
static void trx_write_trx_id (byte *ptr, trx_id_t id)
 Writes a trx id to an index page. More...
 
static trx_id_t trx_read_trx_id (const byte *ptr)
 Reads a trx id from an index page. More...
 
static trx_ttrx_rw_is_active (trx_id_t trx_id, bool do_ref_count)
 Checks if a rw transaction with the given id is active. More...
 
void trx_sys_persist_gtid_num (trx_id_t gtid_trx_no)
 Persist transaction number limit below which all transaction GTIDs are persisted to disk table. More...
 
trx_id_t trx_sys_oldest_trx_no ()
 
void trx_sys_get_binlog_prepared (std::vector< trx_id_t > &trx_ids)
 Get a list of all binlog prepared transactions. More...
 
void trx_sys_read_binlog_position (char *file, uint64_t &offset)
 Get current binary log positions stored. More...
 
bool trx_sys_write_binlog_position (const char *last_file, uint64_t last_offset, const char *file, uint64_t offset)
 Update binary log position if not already updated. More...
 
void trx_sys_update_mysql_binlog_offset (trx_t *trx, mtr_t *mtr)
 Updates the offset information about the end of the MySQL binlog entry which corresponds to the transaction being committed, external XA transaction being prepared or rolled back. More...
 
void trx_sys_close (void)
 Shutdown/Close the transaction system. More...
 
static bool trx_sys_need_rollback ()
 Determine if there are incomplete transactions in the system. More...
 
size_t trx_sys_recovered_active_trxs_count ()
 Reads number of recovered transactions which have state equal to TRX_STATE_ACTIVE (so are not prepared transactions). More...
 
void trx_sys_before_pre_dd_shutdown_validate ()
 Validates lists of transactions at the very beginning of the pre-dd-shutdown phase. More...
 
void trx_sys_after_pre_dd_shutdown_validate ()
 Validates lists of transactions at the very end of the pre-dd-shutdown phase. More...
 
void trx_sys_after_background_threads_shutdown_validate ()
 Validates lists of transactions after all background threads of InnoDB exited during shutdown of MySQL. More...
 
static void trx_sys_rw_trx_add (trx_t *trx)
 Add the transaction to the RW transaction set. More...
 
bool trx_sys_validate_trx_list ()
 Validate the trx_sys_t::rw_trx_list. More...
 
void trx_sys_undo_spaces_init ()
 Initialize trx_sys_undo_spaces, called once during srv_start(). More...
 
void trx_sys_undo_spaces_deinit ()
 Free the resources occupied by trx_sys_undo_spaces, called once during thread de-initialization. More...
 
size_t trx_get_shard_no (trx_id_t trx_id)
 Computes shard number for a given trx_id. More...
 
static void trx_sys_mutex_enter ()
 Acquire the trx_sys->mutex. More...
 
static void trx_sys_mutex_exit ()
 Release the trx_sys->mutex. More...
 
static bool trx_sys_mutex_own ()
 Test if trx_sys->mutex is owned. More...
 
static bool trx_sys_serialisation_mutex_own ()
 Test if trx_sys->serialisation_mutex is owned. More...
 
static void trx_sys_serialisation_mutex_enter ()
 Acquire the trx_sys->serialisation_mutex. More...
 
static void trx_sys_serialisation_mutex_exit ()
 Release the trx_sys->serialisation_mutex. More...
 

Variables

trx_sys_ttrx_sys
 The transaction system. More...
 
uint trx_rseg_n_slots_debug
 
constexpr uint32_t TRX_SYS_SYSTEM_RSEG_ID = 0
 The automatically created system rollback segment has this id. More...
 
constexpr uint32_t TRX_SYS = FSEG_PAGE_DATA
 The offset of the transaction system header on the page. More...
 
constexpr uint32_t TRX_SYS_TRX_ID_STORE = 0
 Transaction system header. More...
 
constexpr uint32_t TRX_SYS_FSEG_HEADER = 8
 segment header for the tablespace segment the trx system is created into More...
 
constexpr uint32_t TRX_SYS_RSEGS = 8 + FSEG_HEADER_SIZE
 the start of the array of rollback segment specification slots More...
 
constexpr size_t TRX_SYS_OLD_N_RSEGS = 256
 
constexpr size_t TRX_SYS_OLD_TMP_RSEGS = 32
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_NAME_LEN = 512
 Maximum length of MySQL binlog file name, in bytes. More...
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_MAGIC_N = 873422344
 Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD. More...
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_MAGIC_N_FLD = 0
 magic number which is TRX_SYS_MYSQL_LOG_MAGIC_N if we have valid data in the MySQL binlog info More...
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_OFFSET_HIGH = 4
 high 4 bytes of the offset within that file More...
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_OFFSET_LOW = 8
 low 4 bytes of the offset within that file More...
 
constexpr uint32_t TRX_SYS_MYSQL_LOG_NAME = 12
 MySQL log file name. More...
 
constexpr size_t TRX_SHARDS_N = 256
 Number of shards created for transactions. More...
 
Space_Idstrx_sys_undo_spaces
 A list of undo tablespace IDs found in the TRX_SYS page. More...
 
constexpr trx_id_t TRX_SYS_TRX_ID_WRITE_MARGIN = 256
 When a trx id which is zero modulo this number (which must be a power of two) is assigned, the field TRX_SYS_TRX_ID_STORE on the transaction system page is updated. More...
 
#define TRX_SYS_DOUBLEWRITE   (UNIV_PAGE_SIZE - 200)
 Doublewrite buffer. More...
 
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE   FSP_EXTENT_SIZE
 Size of the doublewrite block in pages. More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_FSEG = 0
 fseg header of the fseg containing the doublewrite buffer More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC = FSEG_HEADER_SIZE
 4-byte magic number which shows if we already have created the doublewrite buffer More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_BLOCK1 = 4 + FSEG_HEADER_SIZE
 page number of the first page in the first sequence of 64 (= FSP_EXTENT_SIZE) consecutive pages in the doublewrite buffer More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_BLOCK2 = 8 + FSEG_HEADER_SIZE
 page number of the first page in the second sequence of 64 consecutive pages in the doublewrite buffer More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_REPEAT = 12
 we repeat TRX_SYS_DOUBLEWRITE_MAGIC, TRX_SYS_DOUBLEWRITE_BLOCK1, TRX_SYS_DOUBLEWRITE_BLOCK2 so that if the trx sys header is half-written to disk, we still may be able to recover the information More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED = 24 + FSEG_HEADER_SIZE
 If this is not yet set to TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N, we must reset the doublewrite buffer, because starting from 4.1.x the space id of a data page is stored into FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC_N = 536853855
 Contents of TRX_SYS_DOUBLEWRITE_MAGIC. More...
 
constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N = 1783657386
 Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED. More...
 

Detailed Description

Transaction system.

Created 3/26/1996 Heikki Tuuri

Macro Definition Documentation

◆ TRX_SYS_DOUBLEWRITE

#define TRX_SYS_DOUBLEWRITE   (UNIV_PAGE_SIZE - 200)

Doublewrite buffer.

The offset of the doublewrite buffer header on the trx system header page

◆ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE

#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE   FSP_EXTENT_SIZE

Size of the doublewrite block in pages.

◆ TRX_SYS_MYSQL_LOG_INFO

#define TRX_SYS_MYSQL_LOG_INFO   (UNIV_PAGE_SIZE - 1000)

The offset of the MySQL binlog offset info in the trx system header.

◆ TRX_SYS_TRX_NUM_END

#define TRX_SYS_TRX_NUM_END   (TRX_SYS_TRX_NUM_GTID + 8)

◆ TRX_SYS_TRX_NUM_GTID

Reserve next 8 bytes for transaction number up to which GTIDs are persisted to table.

Function Documentation

◆ trx_get_shard_no()

size_t trx_get_shard_no ( trx_id_t  trx_id)
inline

Computes shard number for a given trx_id.

Parameters
[in]trx_idtrx_id for which shard_no should be computed
Returns
the computed shard number (number in range 0..TRX_SHARDS_N-1)

◆ trx_read_trx_id()

static trx_id_t trx_read_trx_id ( const byte ptr)
inlinestatic

Reads a trx id from an index page.

In case that the id size changes in some future version, this function should be used instead of mach_read_...

Returns
id in: pointer to memory from where to read

◆ trx_rw_is_active()

static trx_t * trx_rw_is_active ( trx_id_t  trx_id,
bool  do_ref_count 
)
inlinestatic

Checks if a rw transaction with the given id is active.

Please note, that positive result means only that the trx was active at some moment during the call, but it might have already become TRX_STATE_COMMITTED_IN_MEMORY before the call returns to the caller, as this transition is protected by trx->mutex and Trx_shard's mutex, but it is impossible for the caller to hold any of these mutexes when calling this function as the function itself internally acquires Trx_shard's mutex which would cause recurrent mutex acquisition if caller already had the same mutex, or latching order violation in case of holding trx->mutex.

Parameters
[in]trx_idtrx id of the transaction
[in]do_ref_countif true then increment the trx_t::n_ref_count
Returns
transaction instance if active, or NULL;

◆ trx_sys_after_background_threads_shutdown_validate()

void trx_sys_after_background_threads_shutdown_validate ( )

Validates lists of transactions after all background threads of InnoDB exited during shutdown of MySQL.

◆ trx_sys_after_pre_dd_shutdown_validate()

void trx_sys_after_pre_dd_shutdown_validate ( )

Validates lists of transactions at the very end of the pre-dd-shutdown phase.

At this point we check the mysql_trx_list again, now we don't expect purge thread transactions in the list

◆ trx_sys_allocate_trx_id()

trx_id_t trx_sys_allocate_trx_id ( )
inline

Allocates a new transaction id (for trx->id).

Before calling, the trx_sys_mutex must be acquired.

Returns
new, allocated trx id

◆ trx_sys_allocate_trx_no()

trx_id_t trx_sys_allocate_trx_no ( )
inline

Allocates a new transaction number (for trx->no).

Before calling, the trx_sys_serialisation_mutex must be acquired.

Returns
new, allocated trx no

◆ trx_sys_before_pre_dd_shutdown_validate()

void trx_sys_before_pre_dd_shutdown_validate ( )

Validates lists of transactions at the very beginning of the pre-dd-shutdown phase.

All connections are closed and close_connection unregisters associated trx from mysql_trx_list. We still might have some non started transactions in mysql_trx_list. Purge threads are an exception, they create their own trx_t objects which are not real transactions but are needed for the purge sys to use the query threads framework. Purge sys shutdown happens at a later point in the shutdown sequence so we need to skip its transactions here. IMPORTANT: If allocating transactions for background threads, please use trx_allocate_for_background. This function does not add the trx to the mysql_trx_list so we don't have to add logic to skip these at shutdown.

Skip purge thread trx, it will be cleared after purge sys shutdown

◆ trx_sys_close()

void trx_sys_close ( void  )

Shutdown/Close the transaction system.

◆ trx_sys_create()

void trx_sys_create ( void  )

Creates the trx_sys instance and initializes purge_queue and mutex.

◆ trx_sys_create_sys_pages()

void trx_sys_create_sys_pages ( void  )

Creates and initializes the transaction system at the database creation.

◆ trx_sys_get_binlog_prepared()

void trx_sys_get_binlog_prepared ( std::vector< trx_id_t > &  trx_ids)

Get a list of all binlog prepared transactions.

Parameters
[out]trx_idsall prepared transaction IDs.

◆ trx_sys_get_next_trx_id_or_no()

trx_id_t trx_sys_get_next_trx_id_or_no ( )
inline

Retrieves a next value that will be allocated if trx_sys_allocate_trx_id() or trx_sys_allocate_trx_id_trx_no() was called.

Returns
the next trx->id or trx->no that will be allocated

◆ trx_sys_hdr_page()

static bool trx_sys_hdr_page ( const page_id_t page_id)
inlinestatic

Checks if a page address is the trx sys header page.

Parameters
[in]page_idpage id
Returns
true if trx sys header page

◆ trx_sys_init_at_db_start()

purge_pq_t * trx_sys_init_at_db_start ( void  )

Creates and initializes the central memory structures for the transaction system.

This is called when the database is started.

Returns
min binary heap of rsegs to purge

◆ trx_sys_mutex_enter()

static void trx_sys_mutex_enter ( )
inlinestatic

Acquire the trx_sys->mutex.

◆ trx_sys_mutex_exit()

static void trx_sys_mutex_exit ( )
inlinestatic

Release the trx_sys->mutex.

◆ trx_sys_mutex_own()

static bool trx_sys_mutex_own ( )
inlinestatic

Test if trx_sys->mutex is owned.

◆ trx_sys_need_rollback()

static bool trx_sys_need_rollback ( )
inlinestatic

Determine if there are incomplete transactions in the system.

Returns
whether incomplete transactions need rollback

◆ trx_sys_oldest_trx_no()

trx_id_t trx_sys_oldest_trx_no ( )
Returns
oldest transaction number yet to be committed.

◆ trx_sys_persist_gtid_num()

void trx_sys_persist_gtid_num ( trx_id_t  gtid_trx_no)

Persist transaction number limit below which all transaction GTIDs are persisted to disk table.

Parameters
[in]gtid_trx_notransaction number

◆ trx_sys_read_binlog_position()

void trx_sys_read_binlog_position ( char *  file,
uint64_t &  offset 
)

Get current binary log positions stored.

Parameters
[out]filebinary log file name
[out]offsetbinary log file offset

◆ trx_sys_recovered_active_trxs_count()

size_t trx_sys_recovered_active_trxs_count ( )

Reads number of recovered transactions which have state equal to TRX_STATE_ACTIVE (so are not prepared transactions).

Returns
number of active recovered transactions

◆ trx_sys_rw_trx_add()

static void trx_sys_rw_trx_add ( trx_t trx)
inlinestatic

Add the transaction to the RW transaction set.

Parameters
trxtransaction instance to add

◆ trx_sys_serialisation_mutex_enter()

static void trx_sys_serialisation_mutex_enter ( )
inlinestatic

Acquire the trx_sys->serialisation_mutex.

◆ trx_sys_serialisation_mutex_exit()

static void trx_sys_serialisation_mutex_exit ( )
inlinestatic

Release the trx_sys->serialisation_mutex.

◆ trx_sys_serialisation_mutex_own()

static bool trx_sys_serialisation_mutex_own ( )
inlinestatic

Test if trx_sys->serialisation_mutex is owned.

◆ trx_sys_undo_spaces_deinit()

void trx_sys_undo_spaces_deinit ( )

Free the resources occupied by trx_sys_undo_spaces, called once during thread de-initialization.

◆ trx_sys_undo_spaces_init()

void trx_sys_undo_spaces_init ( )

Initialize trx_sys_undo_spaces, called once during srv_start().

◆ trx_sys_update_mysql_binlog_offset()

void trx_sys_update_mysql_binlog_offset ( trx_t trx,
mtr_t mtr 
)

Updates the offset information about the end of the MySQL binlog entry which corresponds to the transaction being committed, external XA transaction being prepared or rolled back.

In a MySQL replication slave updates the latest master binlog position up to which replication has proceeded.

Parameters
[in]trxCurrent transaction
[in,out]mtrMini-transaction for update

◆ trx_sys_validate_trx_list()

bool trx_sys_validate_trx_list ( )

Validate the trx_sys_t::rw_trx_list.

Returns
true if the list is valid
true if the list is valid.

◆ trx_sys_write_binlog_position()

bool trx_sys_write_binlog_position ( const char *  last_file,
uint64_t  last_offset,
const char *  file,
uint64_t  offset 
)

Update binary log position if not already updated.

This is called by clone to update any stale binary log position if any transaction is yet to update the binary log position in SE.

Parameters
[in]last_filelast noted binary log file name
[in]last_offsetlast noted binary log offset
[in]filecurrent binary log file name
[in]offsetcurrent binary log file offset
Returns
true, if binary log position is updated with current.

◆ trx_sysf_get()

static trx_sysf_t * trx_sysf_get ( mtr_t mtr)
inlinestatic

Gets a pointer to the transaction system file copy and x-locks its page.

Returns
pointer to system file copy, page x-locked in: mtr

◆ trx_sysf_rseg_find_free()

ulint trx_sysf_rseg_find_free ( mtr_t mtr)

Look for a free slot for a rollback segment in the trx system file copy.

Parameters
[in,out]mtrmtr
Returns
slot index or ULINT_UNDEFINED if not found

◆ trx_sysf_rseg_find_page_no()

page_no_t trx_sysf_rseg_find_page_no ( ulint  rseg_id)

Find the page number in the TRX_SYS page for a given slot/rseg_id.

Parameters
[in]rseg_idslot number in the TRX_SYS page rseg array
Returns
page number from the TRX_SYS page rseg array

◆ trx_sysf_rseg_get_page_no()

static page_no_t trx_sysf_rseg_get_page_no ( trx_sysf_t sys_header,
ulint  i,
mtr_t mtr 
)
inlinestatic

Gets the page number of the nth rollback segment slot in the trx system file copy.

Parameters
[in]sys_headertrx sys file copy
[in]islot index == rseg id
[in]mtrmtr
Returns
page number, FIL_NULL if slot unused

◆ trx_sysf_rseg_get_space()

static space_id_t trx_sysf_rseg_get_space ( trx_sysf_t sys_header,
ulint  i,
mtr_t mtr 
)
inlinestatic

Gets the space of the nth rollback segment slot in the trx system file copy.

Parameters
[in]sys_headertrx sys file copy
[in]islot index == rseg id
[in]mtrmtr
Returns
space id

◆ trx_sysf_rseg_set_page_no()

static void trx_sysf_rseg_set_page_no ( trx_sysf_t sys_header,
ulint  i,
page_no_t  page_no,
mtr_t mtr 
)
inlinestatic

Set the page number of the nth rollback segment slot in the trx system file copy.

Parameters
[in]sys_headertrx sys file copy
[in]islot index == rseg id
[in]page_nopage number, FIL_NULL if the slot is reset to unused
[in]mtrmtr

◆ trx_sysf_rseg_set_space()

static void trx_sysf_rseg_set_space ( trx_sysf_t sys_header,
ulint  i,
space_id_t  space,
mtr_t mtr 
)
inlinestatic

Sets the space id of the nth rollback segment slot in the trx system file copy.

Parameters
[in]sys_headertrx sys file copy
[in]islot index == rseg id
[in]spacespace id
[in]mtrmtr

◆ trx_write_trx_id()

static void trx_write_trx_id ( byte ptr,
trx_id_t  id 
)
inlinestatic

Writes a trx id to an index page.

In case that the id size changes in some future version, this function should be used instead of mach_write_...

Parameters
[in]ptrpointer to memory where written
[in]idid

Variable Documentation

◆ trx_rseg_n_slots_debug

uint trx_rseg_n_slots_debug
extern

◆ TRX_SHARDS_N

constexpr size_t TRX_SHARDS_N = 256
constexpr

Number of shards created for transactions.

◆ trx_sys

trx_sys_t* trx_sys
extern

The transaction system.

◆ TRX_SYS

constexpr uint32_t TRX_SYS = FSEG_PAGE_DATA
constexpr

The offset of the transaction system header on the page.

◆ TRX_SYS_DOUBLEWRITE_BLOCK1

constexpr uint32_t TRX_SYS_DOUBLEWRITE_BLOCK1 = 4 + FSEG_HEADER_SIZE
constexpr

page number of the first page in the first sequence of 64 (= FSP_EXTENT_SIZE) consecutive pages in the doublewrite buffer

◆ TRX_SYS_DOUBLEWRITE_BLOCK2

constexpr uint32_t TRX_SYS_DOUBLEWRITE_BLOCK2 = 8 + FSEG_HEADER_SIZE
constexpr

page number of the first page in the second sequence of 64 consecutive pages in the doublewrite buffer

◆ TRX_SYS_DOUBLEWRITE_FSEG

constexpr uint32_t TRX_SYS_DOUBLEWRITE_FSEG = 0
constexpr

fseg header of the fseg containing the doublewrite buffer

◆ TRX_SYS_DOUBLEWRITE_MAGIC

constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC = FSEG_HEADER_SIZE
constexpr

4-byte magic number which shows if we already have created the doublewrite buffer

◆ TRX_SYS_DOUBLEWRITE_MAGIC_N

constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC_N = 536853855
constexpr

Contents of TRX_SYS_DOUBLEWRITE_MAGIC.

◆ TRX_SYS_DOUBLEWRITE_REPEAT

constexpr uint32_t TRX_SYS_DOUBLEWRITE_REPEAT = 12
constexpr

we repeat TRX_SYS_DOUBLEWRITE_MAGIC, TRX_SYS_DOUBLEWRITE_BLOCK1, TRX_SYS_DOUBLEWRITE_BLOCK2 so that if the trx sys header is half-written to disk, we still may be able to recover the information

◆ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED

constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED = 24 + FSEG_HEADER_SIZE
constexpr

If this is not yet set to TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N, we must reset the doublewrite buffer, because starting from 4.1.x the space id of a data page is stored into FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID.

◆ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N

constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N = 1783657386
constexpr

Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED.

◆ TRX_SYS_FSEG_HEADER

constexpr uint32_t TRX_SYS_FSEG_HEADER = 8
constexpr

segment header for the tablespace segment the trx system is created into

◆ TRX_SYS_MYSQL_LOG_MAGIC_N

constexpr uint32_t TRX_SYS_MYSQL_LOG_MAGIC_N = 873422344
constexpr

Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD.

◆ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD

constexpr uint32_t TRX_SYS_MYSQL_LOG_MAGIC_N_FLD = 0
constexpr

magic number which is TRX_SYS_MYSQL_LOG_MAGIC_N if we have valid data in the MySQL binlog info

◆ TRX_SYS_MYSQL_LOG_NAME

constexpr uint32_t TRX_SYS_MYSQL_LOG_NAME = 12
constexpr

MySQL log file name.

◆ TRX_SYS_MYSQL_LOG_NAME_LEN

constexpr uint32_t TRX_SYS_MYSQL_LOG_NAME_LEN = 512
constexpr

Maximum length of MySQL binlog file name, in bytes.

◆ TRX_SYS_MYSQL_LOG_OFFSET_HIGH

constexpr uint32_t TRX_SYS_MYSQL_LOG_OFFSET_HIGH = 4
constexpr

high 4 bytes of the offset within that file

◆ TRX_SYS_MYSQL_LOG_OFFSET_LOW

constexpr uint32_t TRX_SYS_MYSQL_LOG_OFFSET_LOW = 8
constexpr

low 4 bytes of the offset within that file

◆ TRX_SYS_OLD_N_RSEGS

constexpr size_t TRX_SYS_OLD_N_RSEGS = 256
constexpr

◆ TRX_SYS_OLD_TMP_RSEGS

constexpr size_t TRX_SYS_OLD_TMP_RSEGS = 32
constexpr

◆ TRX_SYS_RSEGS

constexpr uint32_t TRX_SYS_RSEGS = 8 + FSEG_HEADER_SIZE
constexpr

the start of the array of rollback segment specification slots

◆ TRX_SYS_SYSTEM_RSEG_ID

constexpr uint32_t TRX_SYS_SYSTEM_RSEG_ID = 0
constexpr

The automatically created system rollback segment has this id.

◆ TRX_SYS_TRX_ID_STORE

constexpr uint32_t TRX_SYS_TRX_ID_STORE = 0
constexpr

Transaction system header.

the maximum trx id or trx number modulo TRX_SYS_TRX_ID_UPDATE_MARGIN written to a file page by any transaction; the assignment of transaction ids continues from this number rounded up by TRX_SYS_TRX_ID_UPDATE_MARGIN plus TRX_SYS_TRX_ID_UPDATE_MARGIN when the database is started

◆ TRX_SYS_TRX_ID_WRITE_MARGIN

constexpr trx_id_t TRX_SYS_TRX_ID_WRITE_MARGIN = 256
constexpr

When a trx id which is zero modulo this number (which must be a power of two) is assigned, the field TRX_SYS_TRX_ID_STORE on the transaction system page is updated.

◆ trx_sys_undo_spaces

Space_Ids* trx_sys_undo_spaces
extern

A list of undo tablespace IDs found in the TRX_SYS page.

This cannot be part of the trx_sys_t object because it is initialized before that object is created. These are the old type of undo tablespaces that do not have space_IDs in the reserved range nor contain an RSEG_ARRAY page.

These are the old type of undo tablespaces that do not have space_IDs in the reserved range nor contain an RSEG_ARRAY page. This cannot be part of the trx_sys_t object because it must be built before that is initialized.