MySQL 8.0.40
Source Code Documentation
trx0rseg.ic File Reference

Rollback segment. More...

#include "mtr0log.h"
#include "srv0srv.h"
#include "trx0purge.h"
#include "trx0sys.h"

Functions

static trx_rsegf_ttrx_rsegf_get (space_id_t space, page_no_t page_no, const page_size_t &page_size, mtr_t *mtr)
 Gets a rollback segment header. More...
 
static trx_rsegf_ttrx_rsegf_get_new (space_id_t space, page_no_t page_no, const page_size_t &page_size, mtr_t *mtr)
 Gets a newly created rollback segment header. More...
 
static page_no_t trx_rsegf_get_nth_undo (trx_rsegf_t *rsegf, ulint n, mtr_t *mtr)
 Gets the file page number of the nth undo log slot. More...
 
static void trx_rsegf_set_nth_undo (trx_rsegf_t *rsegf, ulint n, page_no_t page_no, mtr_t *mtr)
 Sets the file page number of the nth undo log slot. More...
 
static ulint trx_rsegf_undo_find_free (trx_rsegf_t *rsegf, mtr_t *mtr)
 Looks for a free slot for an undo log segment. More...
 
space_id_t trx_rseg_id_to_space_id (ulint id, bool is_temp)
 Convert a 7-bit ID stored in a rollback pointer to an undo space ID. More...
 
trx_rsegsf_ttrx_rsegsf_get (space_id_t space_id, mtr_t *mtr)
 Get a pointer to the rollback segment directory header and x-latches its page. More...
 
page_no_t trx_rsegsf_get_page_no (trx_rsegsf_t *rsegs_header, ulint slot, mtr_t *mtr)
 Get the page number of the nth rollback segment slot in the RSEG_ARRAY page for this undo tablespace. More...
 
static void trx_rsegsf_set_page_no (trx_rsegsf_t *rsegs_header, ulint slot, page_no_t page_no, mtr_t *mtr)
 Sets the page number of the nth rollback segment slot in the independent undo tablespace. More...
 

Detailed Description

Rollback segment.

Created 3/26/1996 Heikki Tuuri

Function Documentation

◆ trx_rseg_id_to_space_id()

space_id_t trx_rseg_id_to_space_id ( ulint  id,
bool  is_temp 
)
inline

Convert a 7-bit ID stored in a rollback pointer to an undo space ID.

Before 8.0, this ID is called an rseg_id and is a slot in the TRX_SYS page where the space_id can be read. After 8.0 this is an undo space number which can be converted directly to an undo space ID.

Parameters
[in]ida 7-bit ID from a rollback pointer
[in]is_temptrue if rseg from Temp Tablespace else false.
Returns
undo tablespace ID containing the rollback segment

◆ trx_rsegf_get()

static trx_rsegf_t * trx_rsegf_get ( space_id_t  space,
page_no_t  page_no,
const page_size_t page_size,
mtr_t mtr 
)
inlinestatic

Gets a rollback segment header.

Parameters
[in]spaceSpace where placed
[in]page_noPage number of the header
[in]page_sizePage size
[in,out]mtrMini-transaction
Returns
rollback segment header, page x-latched

◆ trx_rsegf_get_new()

static trx_rsegf_t * trx_rsegf_get_new ( space_id_t  space,
page_no_t  page_no,
const page_size_t page_size,
mtr_t mtr 
)
inlinestatic

Gets a newly created rollback segment header.

Parameters
[in]spaceSpace where placed
[in]page_noPage number of the header
[in]page_sizePage size
[in,out]mtrMini-transaction
Returns
rollback segment header, page x-latched

◆ trx_rsegf_get_nth_undo()

static page_no_t trx_rsegf_get_nth_undo ( trx_rsegf_t rsegf,
ulint  n,
mtr_t mtr 
)
inlinestatic

Gets the file page number of the nth undo log slot.

Returns
page number of the undo log segment
Parameters
rsegfin: rollback segment header
nin: index of slot
mtrin: mtr

◆ trx_rsegf_set_nth_undo()

static void trx_rsegf_set_nth_undo ( trx_rsegf_t rsegf,
ulint  n,
page_no_t  page_no,
mtr_t mtr 
)
inlinestatic

Sets the file page number of the nth undo log slot.

Parameters
rsegfin: rollback segment header
nin: index of slot
page_noin: page number of the undo log segment
mtrin: mtr

◆ trx_rsegf_undo_find_free()

static ulint trx_rsegf_undo_find_free ( trx_rsegf_t rsegf,
mtr_t mtr 
)
inlinestatic

Looks for a free slot for an undo log segment.

Returns
slot index or ULINT_UNDEFINED if not found
Parameters
rsegfin: rollback segment header
mtrin: mtr

◆ trx_rsegsf_get()

trx_rsegsf_t * trx_rsegsf_get ( space_id_t  space_id,
mtr_t mtr 
)
inline

Get a pointer to the rollback segment directory header and x-latches its page.

Parameters
[in]space_idUndo Tablespace ID
[in]mtrmtr
Returns
pointer to rollback segment directory header with page x-latched.

◆ trx_rsegsf_get_page_no()

page_no_t trx_rsegsf_get_page_no ( trx_rsegsf_t rsegs_header,
ulint  slot,
mtr_t mtr 
)
inline

Get the page number of the nth rollback segment slot in the RSEG_ARRAY page for this undo tablespace.

Parameters
[in]rsegs_headerrollback segment array page header
[in]slotslot index == rseg id
[in]mtrmtr
Returns
page number, FIL_NULL if slot unused

◆ trx_rsegsf_set_page_no()

static void trx_rsegsf_set_page_no ( trx_rsegsf_t rsegs_header,
ulint  slot,
page_no_t  page_no,
mtr_t mtr 
)
inlinestatic

Sets the page number of the nth rollback segment slot in the independent undo tablespace.

Parameters
[in]rsegs_headerrollback segment array page header
[in]slotslot number on page == rseg id
[in]page_norollback regment header page number
[in]mtrmtr