MySQL 8.0.39
Source Code Documentation
|
Purge old versions. More...
#include "fil0fil.h"
#include "mtr0mtr.h"
#include "page0page.h"
#include "que0types.h"
#include "read0types.h"
#include "trx0sys.h"
#include "trx0types.h"
#include "univ.i"
#include "usr0sess.h"
#include "trx0purge.ic"
Go to the source code of this file.
Classes | |
struct | purge_iter_t |
This is the purge pointer/iterator. More... | |
struct | undo::space_id_account |
The currently used undo space IDs for an undo space number along with a boolean showing whether the undo space number is in use. More... | |
struct | undo::Tablespace |
An undo::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to create the automatic file_name and space name. More... | |
class | undo::Tablespaces |
List of undo tablespaces, each containing a list of rollback segments. More... | |
class | undo::Inject_failure_once |
Inject a failure in the undo truncation debug compiled code at various places so that it fails the first time it hits and succeeds after that. More... | |
class | undo::Truncate |
Track an UNDO tablespace marked for truncate. More... | |
struct | trx_purge_t |
The control structure used in the purge operation. More... | |
struct | TrxUndoRsegsIterator |
Choose the rollback segment with the smallest trx_no. More... | |
Namespaces | |
namespace | undo |
Enumerations | |
enum | purge_state_t { PURGE_STATE_INIT , PURGE_STATE_RUN , PURGE_STATE_STOP , PURGE_STATE_EXIT , PURGE_STATE_DISABLED } |
Purge states. More... | |
Functions | |
static fil_addr_t | trx_purge_get_log_from_hist (fil_addr_t node_addr) |
Calculates the file address of an undo log header when we have the file address of its history list node. More... | |
void | trx_purge_sys_mem_create () |
Initialize in-memory purge structures. More... | |
void | trx_purge_sys_initialize (uint32_t n_purge_threads, purge_pq_t *purge_queue) |
Creates the global purge system control structure and inits the history mutex. More... | |
void | trx_purge_sys_close (void) |
Frees the global purge system control structure. More... | |
void | trx_purge_add_update_undo_to_history (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) |
in: mtr More... | |
ulint | trx_purge (ulint n_purge_threads, ulint limit, bool truncate) |
This function runs a purge batch. More... | |
void | trx_purge_stop (void) |
Stop purge and wait for it to stop, move to PURGE_STATE_STOP. More... | |
void | trx_purge_run (void) |
Resume purge, move to PURGE_STATE_RUN. More... | |
purge_state_t | trx_purge_state (void) |
Get the purge state. More... | |
bool | undo::is_reserved (space_id_t space_id) |
Check if the space_id is an undo space ID in the reserved range. More... | |
space_id_t | undo::num2id (space_id_t space_num, size_t ndx) |
Convert an undo space number (from 1 to 127) into the undo space_id, given an index indicating which space_id from the pool assigned to that undo number. More... | |
space_id_t | undo::num2id (space_id_t space_num) |
Convert an undo space number (from 1 to 127) into an undo space_id. More... | |
space_id_t | undo::id2num (space_id_t space_id) |
Convert an undo space ID into an undo space number. More... | |
space_id_t | undo::id2next_id (space_id_t space_id) |
void | undo::init_space_id_bank () |
Initialize the undo tablespace space_id bank which is a lock free repository for information about the space IDs used for undo tablespaces. More... | |
void | undo::use_space_id (space_id_t space_id) |
Note that the undo space number for a space ID is being used. More... | |
space_id_t | undo::use_next_space_id (space_id_t space_num) |
Mark that the given undo space number is being used and return the next available space_id for that space number. More... | |
void | undo::unuse_space_id (space_id_t space_id) |
Mark an undo number associated with a given space_id as unused and available to be reused. More... | |
space_id_t | undo::next_space_id (space_id_t space_id, space_id_t space_num) |
Given a valid undo space_id or SPACE_UNKNOWN, return the next space_id for the given space number. More... | |
space_id_t | undo::next_space_id (space_id_t space_id) |
Given a valid undo space_id, return the next space_id for that space number. More... | |
space_id_t | undo::get_next_available_space_num () |
Return the next available undo space ID to be used for a new explicit undo tablespaces. More... | |
char * | undo::make_space_name (space_id_t space_id) |
Build a standard undo tablespace name from a space_id. More... | |
char * | undo::make_file_name (space_id_t space_id) |
Build a standard undo tablespace file name from a space_id. More... | |
void | undo::inject_crash (const char *injection_point_name) |
Inject a crash if a certain SET GLOBAL DEBUG has been set. More... | |
dberr_t | undo::start_logging (Tablespace *undo_space) |
Create the truncate log file. More... | |
void | undo::done_logging (space_id_t space_num) |
Mark completion of undo truncate action by writing magic number to the log file and then removing it from the disk. More... | |
bool | undo::is_active_truncate_log_present (space_id_t space_num) |
Check if TRUNCATE_DDL_LOG file exist. More... | |
void | undo::add_space_to_construction_list (space_id_t space_id) |
Add undo tablespace to s_under_construction vector. More... | |
void | undo::clear_construction_list () |
Clear the s_under_construction vector. More... | |
bool | undo::is_under_construction (space_id_t space_id) |
Is an undo tablespace under construction at the moment. More... | |
void | undo::set_active (space_id_t space_id) |
Set an undo tablespace active. More... | |
bool | undo::is_active (space_id_t space_id, bool get_latch=true) |
Variables | |
trx_purge_t * | purge_sys |
The global data structure coordinating a purge. More... | |
const uint32_t | undo::s_magic = 76845412 |
Magic Number to indicate truncate action is complete. More... | |
const char *const | undo::s_log_prefix = "undo_" |
Truncate Log file Prefix. More... | |
const char *const | undo::s_log_ext = "trunc.log" |
Truncate Log file Extension. More... | |
struct space_id_account * | undo::space_id_bank |
List of currently used undo space IDs for each undo space number along with a boolean showing whether the undo space number is in use. More... | |
ib_mutex_t | undo::ddl_mutex |
Mutex for serializing undo tablespace related DDL. More... | |
Tablespaces * | undo::spaces |
A global object that contains a vector of undo::Tablespace structs. More... | |
Space_Ids | undo::s_under_construction |
list of undo tablespaces that need header pages and rollback segments written to them at startup. More... | |
constexpr ulint | undo::TRUNCATE_FREQUENCY = 128 |
Purge old versions.
Created 3/26/1996 Heikki Tuuri
enum purge_state_t |
This function runs a purge batch.
n_purge_threads | in: number of purge tasks to submit to the work queue |
batch_size | in: the maximum number of records to purge in one batch |
truncate | in: truncate history if true |
void trx_purge_add_update_undo_to_history | ( | 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 | ||
) |
in: mtr
in: mtr
Removes the update undo log segment from the rseg slot if it is too big for reuse.
trx | in: transaction |
undo_ptr | in/out: update undo log. |
undo_page | in: update undo log header page, x-latched |
update_rseg_history_len | in: if true: update rseg history len else skip updating it. |
n_added_logs | in: number of logs added |
mtr | in: mtr |
|
inlinestatic |
Calculates the file address of an undo log header when we have the file address of its history list node.
void trx_purge_run | ( | void | ) |
Resume purge, move to PURGE_STATE_RUN.
purge_state_t trx_purge_state | ( | void | ) |
Get the purge state.
void trx_purge_stop | ( | void | ) |
Stop purge and wait for it to stop, move to PURGE_STATE_STOP.
void trx_purge_sys_close | ( | void | ) |
Frees the global purge system control structure.
void trx_purge_sys_initialize | ( | uint32_t | n_purge_threads, |
purge_pq_t * | purge_queue | ||
) |
Creates the global purge system control structure and inits the history mutex.
[in] | n_purge_threads | number of purge threads |
[in,out] | purge_queue | UNDO log min binary heap |
void trx_purge_sys_mem_create | ( | ) |
Initialize in-memory purge structures.
|
extern |
The global data structure coordinating a purge.