MySQL 8.0.40
Source Code Documentation
trx0undo.ic File Reference

Transaction undo log. More...

#include "data0type.h"
#include "page0page.h"
#include "trx0purge.h"

Functions

roll_ptr_t trx_undo_build_roll_ptr (bool is_insert, space_id_t space_id, page_no_t page_no, ulint offset)
 Build a roll pointer. More...
 
void trx_undo_decode_roll_ptr (roll_ptr_t roll_ptr, bool *is_insert, ulint *rseg_id, page_no_t *page_no, ulint *offset)
 Decodes a roll pointer. More...
 
static bool trx_undo_roll_ptr_is_insert (roll_ptr_t roll_ptr)
 Returns true if the roll pointer is of the insert type. More...
 
static bool trx_undo_trx_id_is_insert (const byte *trx_id)
 Returns true if the record is of the insert type. More...
 
static void trx_write_roll_ptr (byte *ptr, roll_ptr_t roll_ptr)
 Writes a roll ptr to an index page. More...
 
static roll_ptr_t trx_read_roll_ptr (const byte *ptr)
 Reads a roll ptr from an index page. More...
 
static page_ttrx_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. More...
 
static page_ttrx_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. More...
 
static ulint trx_undo_page_get_start (page_t *undo_page, page_no_t page_no, ulint offset)
 Returns the start offset of the undo log records of the specified undo log on the page. More...
 
static ulint trx_undo_page_get_end (page_t *undo_page, page_no_t page_no, ulint offset)
 Returns the end offset of the undo log records of the specified undo log on the page. More...
 
static trx_undo_rec_ttrx_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. More...
 
static trx_undo_rec_ttrx_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. More...
 
static trx_undo_rec_ttrx_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. More...
 
static trx_undo_rec_ttrx_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. More...
 

Detailed Description

Transaction undo log.

Created 3/26/1996 Heikki Tuuri

Function Documentation

◆ trx_read_roll_ptr()

static roll_ptr_t trx_read_roll_ptr ( const byte ptr)
inlinestatic

Reads a roll ptr from an index page.

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

Returns
roll ptr
Parameters
ptrin: pointer to memory from where to read

◆ trx_undo_build_roll_ptr()

roll_ptr_t trx_undo_build_roll_ptr ( bool  is_insert,
space_id_t  space_id,
page_no_t  page_no,
ulint  offset 
)
inline

Build a roll pointer.

Parameters
[in]is_inserttrue if insert undo log
[in]space_idspace ID of the rollback segment
[in]page_nopage number
[in]offsetoffset of the undo entry within page
Returns
roll pointer

◆ trx_undo_decode_roll_ptr()

void trx_undo_decode_roll_ptr ( roll_ptr_t  roll_ptr,
bool *  is_insert,
ulint rseg_id,
page_no_t page_no,
ulint offset 
)
inline

Decodes a roll pointer.

Parameters
roll_ptrin: roll pointer
is_insertout: true if insert undo log
rseg_idout: rollback segment id
page_noout: page number
offsetout: offset of the undo entry within page

◆ trx_undo_page_get()

static page_t * trx_undo_page_get ( const page_id_t page_id,
const page_size_t page_size,
mtr_t mtr 
)
inlinestatic

Gets an undo log page and x-latches it.

Parameters
[in]page_idPage id
[in]page_sizePage size
[in,out]mtrMini-transaction
Returns
pointer to page x-latched

◆ trx_undo_page_get_end()

static ulint trx_undo_page_get_end ( page_t undo_page,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the end offset of the undo log records of the specified undo log on the page.

Returns
end offset
Parameters
undo_pagein: undo log page
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_page_get_first_rec()

static trx_undo_rec_t * trx_undo_page_get_first_rec ( page_t undo_page,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the first undo record on the page in the specified undo log, or NULL if none exists.

Returns
pointer to record, NULL if none
Parameters
undo_pagein: undo log page
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_page_get_last_rec()

static trx_undo_rec_t * trx_undo_page_get_last_rec ( page_t undo_page,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the last undo record on the page in the specified undo log, or NULL if none exists.

Returns
pointer to record, NULL if none
Parameters
undo_pagein: undo log page
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_page_get_next_rec()

static trx_undo_rec_t * trx_undo_page_get_next_rec ( trx_undo_rec_t rec,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the next undo log record on the page in the specified log, or NULL if none exists.

Returns
pointer to record, NULL if none
Parameters
recin: undo log record
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_page_get_prev_rec()

static trx_undo_rec_t * trx_undo_page_get_prev_rec ( trx_undo_rec_t rec,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the previous undo record on the page in the specified log, or NULL if none exists.

Returns
pointer to record, NULL if none
Parameters
recin: undo log record
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_page_get_s_latched()

static page_t * trx_undo_page_get_s_latched ( const page_id_t page_id,
const page_size_t page_size,
mtr_t mtr 
)
inlinestatic

Gets an undo log page and s-latches it.

Parameters
[in]page_idPage id
[in]page_sizePage size
[in,out]mtrMini-transaction
Returns
pointer to page s-latched

◆ trx_undo_page_get_start()

static ulint trx_undo_page_get_start ( page_t undo_page,
page_no_t  page_no,
ulint  offset 
)
inlinestatic

Returns the start offset of the undo log records of the specified undo log on the page.

Returns
start offset
Parameters
undo_pagein: undo log page
page_noin: undo log header page number
offsetin: undo log header offset on page

◆ trx_undo_roll_ptr_is_insert()

static bool trx_undo_roll_ptr_is_insert ( roll_ptr_t  roll_ptr)
inlinestatic

Returns true if the roll pointer is of the insert type.

Returns
true if insert undo log
Parameters
roll_ptrin: roll pointer

◆ trx_undo_trx_id_is_insert()

static bool trx_undo_trx_id_is_insert ( const byte trx_id)
inlinestatic

Returns true if the record is of the insert type.

Returns
true if the record was freshly inserted (not updated).
Parameters
trx_idin: DB_TRX_ID, followed by DB_ROLL_PTR

◆ trx_write_roll_ptr()

static void trx_write_roll_ptr ( byte ptr,
roll_ptr_t  roll_ptr 
)
inlinestatic

Writes a roll ptr to an index page.

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

Parameters
ptrin: pointer to memory where written
roll_ptrin: roll ptr