MySQL 8.4.3
Source Code Documentation
|
Classes | |
class | 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... | |
struct | 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 | 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 | Tablespaces |
List of undo tablespaces, each containing a list of rollback segments. More... | |
class | Truncate |
Track an UNDO tablespace marked for truncate. More... | |
Functions | |
bool | 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 | 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 | num2id (space_id_t space_num) |
Convert an undo space number (from 1 to 127) into an undo space_id. More... | |
space_id_t | id2num (space_id_t space_id) |
Convert an undo space ID into an undo space number. More... | |
space_id_t | id2next_id (space_id_t space_id) |
void | 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 | 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 | 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 | 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 | 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 | 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 | get_next_available_space_num () |
Return the next available undo space ID to be used for a new explicit undo tablespaces. More... | |
char * | make_space_name (space_id_t space_id) |
Build a standard undo tablespace name from a space_id. More... | |
char * | make_file_name (space_id_t space_id) |
Build a standard undo tablespace file name from a space_id. More... | |
void | inject_crash (const char *injection_point_name) |
Inject a crash if a certain SET GLOBAL DEBUG has been set. More... | |
dberr_t | start_logging (Tablespace *undo_space) |
Create the truncate log file. More... | |
void | 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 | is_active_truncate_log_present (space_id_t space_num) |
Check if TRUNCATE_DDL_LOG file exist. More... | |
void | add_space_to_construction_list (space_id_t space_id) |
Add undo tablespace to s_under_construction vector. More... | |
void | clear_construction_list () |
Clear the s_under_construction vector. More... | |
bool | is_under_construction (space_id_t space_id) |
Is an undo tablespace under construction at the moment. More... | |
void | set_active (space_id_t space_id) |
Set an undo tablespace active. More... | |
bool | is_active (space_id_t space_id, bool get_latch=true) |
Variables | |
const uint32_t | s_magic = 76845412 |
Magic Number to indicate truncate action is complete. More... | |
const char *const | s_log_prefix = "undo_" |
Truncate Log file Prefix. More... | |
const char *const | s_log_ext = "trunc.log" |
Truncate Log file Extension. More... | |
struct space_id_account * | 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 | ddl_mutex |
Mutex for serializing undo tablespace related DDL. More... | |
Tablespaces * | spaces |
A global object that contains a vector of undo::Tablespace structs. More... | |
Space_Ids | s_under_construction |
list of undo tablespaces that need header pages and rollback segments written to them at startup. More... | |
constexpr ulint | TRUNCATE_FREQUENCY = 128 |
void undo::add_space_to_construction_list | ( | space_id_t | space_id | ) |
Add undo tablespace to s_under_construction vector.
[in] | space_id | space id of tablespace to truncate |
void undo::clear_construction_list | ( | ) |
Clear the s_under_construction vector.
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.
If we are going to remove it from disk then why write magic number? This is to safeguard from unlink (file-system) anomalies that will keep the link to the file even after unlink action is successful and ref-count = 0.
[in] | space_num | number of the undo tablespace to truncate. |
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.
The slot will be marked as in-use.
|
inline |
|
inline |
Convert an undo space ID into an undo space number.
NOTE: This may be an undo space_id from a pre-exisiting 5.7 database which used space_ids from 1 to 127. If so, the space_id is the space_num. The space_ids are assigned to number ranges in reverse from high to low. In addition, the first space IDs for each undo number occur sequentially and descending before the second space_id.
Since s_max_undo_space_id = 0xFFFFFFEF, FSP_MAX_UNDO_TABLESPACES = 127 and s_undo_space_id_range = 400,000: Space ID Space Num Space ID Space Num ... Space ID Space Num 0xFFFFFFEF 1 0xFFFFFFEe 2 ... 0xFFFFFF71 127 0xFFFFFF70 1 0xFFFFFF6F 2 ... 0xFFFFFEF2 127 0xFFFFFEF1 1 0xFFFFFEF0 2 ... 0xFFFFFE73 127 ...
This is done to maintain backward compatibility to when there was only one space_id per undo space number.
[in] | space_id | undo tablespace 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.
It is used during creation in order to assign an unused space number and during truncation in order to assign the next space_id within that space_number range.
It is used during creation in order to assign an unused space number and during truncation in order to assign the next space_id within that space_number range. It is initialized with the minimum value in the range so that if a new space ID is needed in that range the max space ID will be used first. As truncation occurs, the space_ids are assigned from max down to min.
void undo::inject_crash | ( | const char * | injection_point_name | ) |
Inject a crash if a certain SET GLOBAL DEBUG has been set.
Before DBUG_SUICIDE(), write an entry about this crash to the error log and flush the redo log.
bool undo::is_active | ( | space_id_t | space_id, |
bool | get_latch = true |
||
) |
bool undo::is_active_truncate_log_present | ( | space_id_t | space_num | ) |
Check if TRUNCATE_DDL_LOG file exist.
[in] | space_num | undo tablespace number |
|
inline |
Check if the space_id is an undo space ID in the reserved range.
[in] | space_id | undo tablespace ID |
bool undo::is_under_construction | ( | space_id_t | space_id | ) |
Is an undo tablespace under construction at the moment.
[in] | space_id | space id to check |
char * undo::make_file_name | ( | space_id_t | space_id | ) |
Build a standard undo tablespace file name from a space_id.
This will create a name like 'undo_001' if the space_id is in the reserved range, else it will be like 'undo001'.
[in] | space_id | id of the undo tablespace. |
char * undo::make_space_name | ( | space_id_t | space_id | ) |
Build a standard undo tablespace name from a space_id.
[in] | space_id | id of the undo tablespace. |
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.
[in] | space_id | undo tablespace ID |
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.
[in] | space_id | undo tablespace ID |
[in] | space_num | undo tablespace number |
|
inline |
Convert an undo space number (from 1 to 127) into an undo space_id.
Use the undo::space_id_bank to return the current space_id assigned to that undo number.
[in] | space_num | undo tablespace number |
|
inline |
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.
[in] | space_num | undo tablespace number |
[in] | ndx | index of the space_id within that undo number |
void undo::set_active | ( | space_id_t | space_id | ) |
Set an undo tablespace active.
dberr_t undo::start_logging | ( | Tablespace * | undo_space | ) |
Create the truncate log file.
Needed to track the state of truncate during a crash. An auxiliary redo log file undo_<space_id>_trunc.log will be created while the truncate of the UNDO is in progress. This file is required during recovery to complete the truncate.
[in] | undo_space | undo tablespace to truncate. |
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.
Mark an undo number associated with a given space_id as unused and available to be resused.
This happens when the fil_space_t is closed associated with a drop undo tablespace.
[in] | space_id | Undo Tablespace ID |
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.
[in] | space_num | undo tablespace number |
void undo::use_space_id | ( | space_id_t | space_id | ) |
Note that the undo space number for a space ID is being used.
Put that space_id into the space_id_bank.
[in] | space_id | undo tablespace number |
ib_mutex_t undo::ddl_mutex |
Mutex for serializing undo tablespace related DDL.
Mutext for serializing undo tablespace related DDL.
These have to do with creating and dropping undo tablespaces.
const char* const undo::s_log_ext = "trunc.log" |
Truncate Log file Extension.
const char* const undo::s_log_prefix = "undo_" |
Truncate Log file Prefix.
const uint32_t undo::s_magic = 76845412 |
Magic Number to indicate truncate action is complete.
|
extern |
list of undo tablespaces that need header pages and rollback segments written to them at startup.
This can be because they are newly initialized, were being truncated and the system crashed, or they were an old format at startup and were replaced when they were opened. Old format undo tablespaces do not have space_ids between dict_sys_t::s_min_undo_space_id and dict_sys_t::s_max_undo_space_id and they do not contain an RSEG_ARRAY page.
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.
Tablespaces * undo::spaces |
A global object that contains a vector of undo::Tablespace structs.
|
constexpr |