259 page_t *undo_page,
bool update_rseg_history_len,
335#ifndef UNIV_HOTBACKUP
488#define TRX_UNDO_PAGE_REUSE_LIMIT (3 * UNIV_PAGE_SIZE / 4)
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:52
uint32_t page_no_t
Page number.
Definition: api0api.h:50
Data structure that contains the information about shared tablespaces.
Definition: fsp0space.h:47
Page identifier.
Definition: buf0types.h:207
Page size descriptor.
Definition: page0size.h:50
int page
Definition: ctype-mb.cc:1236
dberr_t
Definition: db0err.h:39
constexpr uint32_t FSEG_PAGE_DATA
On a page of any file segment, data may be put starting from this offset.
Definition: fsp0types.h:79
constexpr uint32_t FSEG_HEADER_SIZE
Length of the file system header, in bytes.
Definition: fsp0types.h:94
constexpr ulint FLST_BASE_NODE_SIZE
Definition: fut0lst.h:50
constexpr ulint FLST_NODE_SIZE
Definition: fut0lst.h:53
mlog_id_t
Definition: mtr0types.h:63
mode
Definition: file_handle.h:60
Definition: trx0purge.h:141
byte page_t
Type of the index page.
Definition: page0types.h:152
required string type
Definition: replication_group_member_actions.proto:34
static bool rollback(THD *thd)
Abort the current statement and transaction.
Definition: sql_cmd_srs.cc:140
The buffer control block structure.
Definition: buf0buf.h:1690
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:177
The rollback segment memory object.
Definition: trx0types.h:214
Definition: trx0trx.h:675
The transaction handle.
Definition: trx0trx.h:635
Transaction undo log memory object; this is protected by the undo_mutex in the corresponding transact...
Definition: trx0undo.h:339
page_no_t last_page_no
page number of the last page in the undo log; this may differ from top_page_no during a rollback
Definition: trx0undo.h:409
bool del_marks
relevant only in an update undo log: this is true if the transaction may have delete marked records,...
Definition: trx0undo.h:381
void set_prepared(const XID *in_xid)
Definition: trx0undo.ic:285
bool dict_operation
true if a dict operation trx
Definition: trx0undo.h:399
ulint type
TRX_UNDO_INSERT or TRX_UNDO_UPDATE.
Definition: trx0undo.h:377
page_size_t page_size
Definition: trx0undo.h:404
buf_block_t * guess_block
guess for the buffer block where the top page might reside
Definition: trx0undo.h:424
trx_id_t trx_id
id of the trx assigned to the undo log
Definition: trx0undo.h:389
ulint id
undo log slot number within the rollback segment
Definition: trx0undo.h:375
ulint empty
true if the stack of undo log records is currently empty
Definition: trx0undo.h:414
space_id_t space
space id where the undo log placed
Definition: trx0undo.h:402
page_no_t top_page_no
page number where the latest undo log record was catenated; during rollback the page from which the l...
Definition: trx0undo.h:416
std::tuple< int, size_t > gtid_get_details(bool is_prepare) const
Get offset and flag for GTID stored in undo.
Definition: trx0undo.cc:638
trx_rseg_t * rseg
rseg where the undo log belongs
Definition: trx0undo.h:400
XID xid
X/Open XA transaction identification.
Definition: trx0undo.h:391
bool gtid_allocated(bool is_prepare) const
Check if space for GTID is allocated in undo.
Definition: trx0undo.cc:630
void set_prepared_in_tc()
Definition: trx0undo.ic:291
undo_no_t top_undo_no
undo number of the latest record
Definition: trx0undo.h:423
UT_LIST_NODE_T(trx_undo_t) undo_list
undo log objects in the rollback segment are chained into lists
bool is_prepared() const
Definition: trx0undo.ic:296
ulint state
state of the corresponding undo log segment
Definition: trx0undo.h:379
ulint flag
flag for current transaction XID and GTID.
Definition: trx0undo.h:393
Gtid_storage m_gtid_storage
Storage space allocated for GTIDs.
Definition: trx0undo.h:397
page_no_t hdr_page_no
page number of the header page in the undo log
Definition: trx0undo.h:405
ulint hdr_offset
header offset of the undo log on the page
Definition: trx0undo.h:407
Gtid_storage
Undo log may could be allocated to store transaction GTIDs.
Definition: trx0undo.h:341
ulint top_offset
offset of the latest undo record, i.e., the topmost element in the undo log if we think of it as a st...
Definition: trx0undo.h:420
ulint size
current size in pages
Definition: trx0undo.h:412
An undo::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to ...
Definition: trx0purge.h:314
struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification,...
Definition: xa.h:83
Transaction system global type definitions.
byte trx_undo_rec_t
Undo log record.
Definition: trx0types.h:167
ib_id_t undo_no_t
Undo number.
Definition: trx0types.h:142
byte trx_ulogf_t
Undo log header.
Definition: trx0types.h:163
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:138
ib_id_t roll_ptr_t
Rollback pointer (DB_ROLL_PTR, DATA_ROLL_PTR)
Definition: trx0types.h:140
constexpr uint32_t TRX_UNDO_STATE
Undo log segment header.
Definition: trx0undo.h:508
constexpr uint32_t TRX_UNDO_DICT_TRANS
true if the transaction is a table create, index create, or drop transaction: in recovery the transac...
Definition: trx0undo.h:551
static trx_undo_rec_t * trx_undo_page_get_prev_rec(trx_undo_rec_t *rec, page_no_t page_no, ulint offset)
Returns the previous undo record on the page in the specified log, or NULL if none exists.
constexpr uint32_t TRX_UNDO_NEXT_LOG
Offset of the next undo log header on this page, 0 if none.
Definition: trx0undo.h:555
constexpr uint32_t TRX_UNDO_XA_FORMAT
X/Open XA Transaction Identification (XID)
Definition: trx0undo.h:576
static page_t * trx_undo_page_get(const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr)
Gets an undo log page and x-latches it.
constexpr uint32_t TRX_UNDO_PAGE_FREE
On each page of the undo log this field contains the byte offset of the first free byte on the page.
Definition: trx0undo.h:475
constexpr uint32_t TRX_UNDO_PAGE_NODE
The file list node in the chain of undo log pages.
Definition: trx0undo.h:477
static bool trx_undo_trx_id_is_insert(const byte *trx_id)
Returns true if the record is of the insert type.
constexpr uint32_t TRX_UNDO_INSERT
Types of an undo log segment.
Definition: trx0undo.h:311
constexpr uint32_t TRX_UNDO_PAGE_LIST
Base node for the list of pages in the undo log segment; defined only on the undo log segment's first...
Definition: trx0undo.h:515
void trx_undo_gtid_read_and_persist(trx_ulogf_t *undo_log)
Read and persist GTID from undo header during recovery.
Definition: trx0undo.cc:667
constexpr uint32_t TRX_UNDO_HISTORY_NODE
If the log is put to the history list, the file list node is here.
Definition: trx0undo.h:559
trx_undo_rec_t * trx_undo_get_next_rec(trx_undo_rec_t *rec, page_no_t page_no, ulint offset, mtr_t *mtr)
Gets the next record in an undo log.
Definition: trx0undo.cc:261
constexpr uint32_t TRX_UNDO_FLAG_GTID
true if undo log header includes GTID information from replication
Definition: trx0undo.h:544
constexpr uint32_t TRX_UNDO_DEL_MARKS
Defined only in an update undo log: true if the transaction may have done delete markings of records,...
Definition: trx0undo.h:533
constexpr uint32_t TRX_UNDO_LOG_GTID_XA_HDR_SIZE
Total size with XA GTID information.
Definition: trx0undo.h:612
static bool trx_undo_roll_ptr_is_insert(roll_ptr_t roll_ptr)
Returns true if the roll pointer is of the insert type.
constexpr uint32_t TRX_UNDO_FLAG_XID
true if undo log header includes X/Open XA transaction identification XID
Definition: trx0undo.h:542
constexpr uint32_t TRX_UNDO_SEG_HDR_SIZE
Size of the undo log segment header.
Definition: trx0undo.h:518
void trx_undo_update_cleanup(trx_t *trx, trx_undo_ptr_t *undo_ptr, page_t *undo_page, bool update_rseg_history_len, ulint n_added_logs, mtr_t *mtr)
Adds the update undo log header as the first in the history list, and frees the memory object,...
Definition: trx0undo.cc:1922
constexpr uint32_t TRX_UNDO_TO_PURGE
update undo segment will not be reused: it can be freed in purge when all undo data in it is removed
Definition: trx0undo.h:325
static void trx_undo_truncate_end(const trx_t *trx, trx_undo_t *undo, undo_no_t limit)
Definition: trx0undo.h:194
constexpr uint32_t TRX_UNDO_CACHED
cached for quick reuse
Definition: trx0undo.h:320
page_t * trx_undo_set_state_at_finish(trx_undo_t *undo, mtr_t *mtr)
Sets the state of the undo log segment at a transaction finish.
Definition: trx0undo.cc:1799
constexpr uint32_t TRX_UNDO_XA_BQUAL_LEN
xid_t::bqual_length
Definition: trx0undo.h:580
constexpr uint32_t TRX_UNDO_PAGE_HDR_SIZE
Size of the transaction undo log page header, in bytes.
Definition: trx0undo.h:480
constexpr uint32_t TRX_UNDO_PAGE_TYPE
Transaction undo log page header offsets.
Definition: trx0undo.h:468
constexpr uint32_t TRX_UNDO_ACTIVE
contains an undo log of an active transaction
Definition: trx0undo.h:318
byte * trx_undo_parse_page_header(mlog_id_t type, const byte *ptr, const byte *end_ptr, page_t *page, mtr_t *mtr)
Parse the redo log entry of an undo log page header create or reuse.
Definition: trx0undo.cc:841
void trx_undo_free_trx_with_prepared_or_active_logs(trx_t *trx, bool prepared) UNIV_COLD
At shutdown, frees the undo logs of a transaction which was either PREPARED or (ACTIVE and recovered)...
Definition: trx0undo.cc:1995
constexpr uint32_t TRX_UNDO_PAGE_HDR
The offset of the undo log page header on pages of the undo log.
Definition: trx0undo.h:463
constexpr uint32_t TRX_UNDO_LOG_XA_HDR_SIZE
Total size of the undo log header with the XA XID.
Definition: trx0undo.h:584
constexpr uint32_t TRX_UNDO_FSEG_HEADER
Header for the file segment which the undo log segment occupies.
Definition: trx0undo.h:512
byte * trx_undo_parse_page_init(const byte *ptr, const byte *end_ptr, page_t *page, mtr_t *mtr)
Parses the redo log entry of an undo log page initialization.
Definition: trx0undo.cc:345
constexpr uint32_t TRX_UNDO_SEG_HDR
The offset of the undo log segment header on the first page of the undo log segment.
Definition: trx0undo.h:502
dberr_t trx_undo_gtid_add_update_undo(trx_t *trx, bool prepare, bool rollback)
For saving GTID add update undo slot, if required.
Definition: trx0undo.cc:585
constexpr uint32_t TRX_UNDO_FLAG_XA_PREPARE_GTID
true if undo log header includes GTID information for XA PREPARE
Definition: trx0undo.h:546
trx_undo_rec_t * trx_undo_get_first_rec(trx_id_t *modifier_trx_id, space_id_t space, const page_size_t &page_size, page_no_t page_no, ulint offset, ulint mode, mtr_t *mtr)
Gets the first record in an undo log.
Definition: trx0undo.cc:296
constexpr uint32_t TRX_UNDO_TABLE_ID
Id of the table if the preceding field is true.
Definition: trx0undo.h:553
bool trx_undo_truncate_tablespace(undo::Tablespace *marked_space)
Truncate UNDO tablespace, reinitialize header and rseg.
Definition: trx0undo.cc:2038
static trx_undo_rec_t * trx_undo_page_get_next_rec(trx_undo_rec_t *rec, page_no_t page_no, ulint offset)
Returns the next undo log record on the page in the specified log, or NULL if none exists.
ulint trx_undo_lists_init(trx_rseg_t *rseg)
Initializes the undo log lists for a rollback segment memory copy.
Definition: trx0undo.cc:1406
constexpr uint32_t TRX_UNDO_LOG_GTID_VERSION
GTID version offset.
Definition: trx0undo.h:595
static trx_undo_rec_t * trx_undo_page_get_first_rec(page_t *undo_page, page_no_t page_no, ulint offset)
Returns the first undo record on the page in the specified undo log, or NULL if none exists.
constexpr uint32_t TRX_UNDO_LOG_GTID_HDR_SIZE
Total size with GTID information.
Definition: trx0undo.h:604
void trx_undo_insert_cleanup(trx_undo_ptr_t *undo_ptr, bool noredo)
Frees an insert undo log after a transaction commit or rollback.
Definition: trx0undo.cc:1957
constexpr uint32_t TRX_UNDO_LAST_LOG
Offset of the last undo log header on the segment header page, 0 if none.
Definition: trx0undo.h:510
constexpr uint32_t TRX_UNDO_LOG_GTID_LEN
Total length of GTID.
Definition: trx0undo.h:601
page_t * trx_undo_set_prepared_in_tc(trx_t *trx, trx_undo_t *undo, mtr_t *mtr)
Set the state of the undo log segment as prepared in TC.
Definition: trx0undo.cc:1881
constexpr uint32_t TRX_UNDO_LOG_OLD_HDR_SIZE
Size of the undo log header without XID information.
Definition: trx0undo.h:562
static roll_ptr_t trx_read_roll_ptr(const byte *ptr)
Reads a roll ptr from an index page.
constexpr uint32_t TRX_UNDO_PREV_LOG
Offset of the previous undo log header on this page, 0 if none.
Definition: trx0undo.h:557
dberr_t trx_undo_assign_undo(trx_t *trx, trx_undo_ptr_t *undo_ptr, ulint type)
Assigns an undo log for a transaction.
Definition: trx0undo.cc:1688
constexpr uint32_t TRX_UNDO_PREPARED_80028
contains an undo log of an prepared transaction for a server version older than 8....
Definition: trx0undo.h:328
buf_block_t * trx_undo_add_page(trx_t *trx, trx_undo_t *undo, trx_undo_ptr_t *undo_ptr, mtr_t *mtr)
Tries to add a page to the undo log segment where the undo log is placed.
Definition: trx0undo.cc:921
static void trx_undo_free_last_page(const trx_t *trx, trx_undo_t *undo, mtr_t *mtr)
Definition: trx0undo.h:180
void trx_undo_gtid_set(trx_t *trx, trx_undo_t *undo, bool is_xa_prepare)
Set GTID flag in undo if transaction has GTID/.
Definition: trx0undo.cc:645
constexpr uint32_t TRX_UNDO_TRX_NO
Transaction number of the transaction; defined only if the log is in a history list.
Definition: trx0undo.h:530
constexpr uint32_t TRX_UNDO_PREPARED_IN_TC
Definition: trx0undo.h:333
void trx_undo_truncate_start(trx_rseg_t *rseg, page_no_t hdr_page_no, ulint hdr_offset, undo_no_t limit)
Truncate the head of an undo log.
Definition: trx0undo.cc:1181
constexpr uint32_t TRX_UNDO_XA_XID
Distributed transaction identifier data.
Definition: trx0undo.h:582
static trx_undo_rec_t * trx_undo_page_get_last_rec(page_t *undo_page, page_no_t page_no, ulint offset)
Returns the last undo record on the page in the specified undo log, or NULL if none exists.
constexpr uint32_t TRX_UNDO_FLAGS
Transaction UNDO flags in one byte.
Definition: trx0undo.h:540
trx_undo_rec_t * trx_undo_get_prev_rec(trx_undo_rec_t *rec, page_no_t page_no, ulint offset, bool shared, mtr_t *mtr)
Gets the previous record in an undo log.
Definition: trx0undo.cc:192
constexpr uint32_t TRX_UNDO_PAGE_START
Byte offset where the undo log records for the LATEST transaction start on this page (remember that i...
Definition: trx0undo.h:472
void trx_undo_gtid_write(trx_t *trx, trx_ulogf_t *undo_header, trx_undo_t *undo, mtr_t *mtr, bool is_xa_prepare)
Write GTID information to undo log header.
Definition: trx0undo.cc:719
constexpr uint32_t TRX_UNDO_LOG_GTID_XA
GTID offset for XA Prepare.
Definition: trx0undo.h:608
constexpr uint32_t TRX_UNDO_UPDATE
contains undo entries for updates and delete markings: in short, modifys (the name 'UPDATE' is a hist...
Definition: trx0undo.h:314
void trx_undo_truncate_end_func(const trx_t *trx, trx_undo_t *undo, undo_no_t limit)
Truncates an undo log from the end.
Definition: trx0undo.cc:1127
constexpr uint32_t TRX_UNDO_TRX_ID
The undo log header.
Definition: trx0undo.h:527
static void trx_write_roll_ptr(byte *ptr, roll_ptr_t roll_ptr)
Writes a roll ptr to an index page.
constexpr uint32_t TRX_UNDO_XA_TRID_LEN
xid_t::gtrid_length
Definition: trx0undo.h:578
void trx_undo_free_last_page_func(const trx_t *trx, trx_undo_t *undo, mtr_t *mtr)
Frees the last undo log page.
Definition: trx0undo.cc:1034
void trx_undo_mem_free(trx_undo_t *undo)
Frees an undo log memory copy.
Definition: trx0undo.cc:1530
constexpr uint32_t TRX_UNDO_LOG_GTID
GTID offset.
Definition: trx0undo.h:598
page_t * trx_undo_set_state_at_prepare(trx_t *trx, trx_undo_t *undo, bool rollback, mtr_t *mtr)
Set the state of the undo log segment at a XA PREPARE or XA ROLLBACK.
Definition: trx0undo.cc:1839
static page_t * trx_undo_page_get_s_latched(const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr)
Gets an undo log page and s-latches it.
constexpr uint32_t TRX_UNDO_PREPARED
contains an undo log of an prepared transaction
Definition: trx0undo.h:330
constexpr uint32_t TRX_UNDO_LOG_START
Offset of the first undo log record of this log on the header page; purge may remove undo log record ...
Definition: trx0undo.h:537
constexpr uint32_t TRX_UNDO_TO_FREE
insert undo segment can be freed
Definition: trx0undo.h:322
Version control for database, common definitions, and include files.
#define UNIV_COLD
Definition: univ.i:267
#define IF_DEBUG(...)
Definition: univ.i:674
unsigned long int ulint
Definition: univ.i:406
#define UT_LIST_NODE_GETTER_DEFINITION(t, m)
A helper for the UT_LIST_BASE_NODE_T_EXTERN which declares a node getter struct which extracts member...
Definition: ut0lst.h:270
bool is_xa_prepare(THD *thd)
Checks whether or not the underlying statement is an XA PREPARE.
Definition: xa.cc:694
#define XIDDATASIZE
Definition: xa.h:73
static void prepare(pax_msg *p, pax_op op)
Definition: xcom_base.cc:1587