MySQL 8.0.40
Source Code Documentation
|
File space management. More...
#include "fsp0fsp.h"
#include "buf0buf.h"
#include "fil0fil.h"
#include "ha_prototypes.h"
#include "mtr0log.h"
#include "my_dbug.h"
#include "page0page.h"
#include "page0zip.h"
#include "ut0byte.h"
#include <my_aes.h>
#include <debug_sync.h>
#include "btr0btr.h"
#include "btr0sea.h"
#include "dict0boot.h"
#include "dict0dd.h"
#include "fut0fut.h"
#include "ibuf0ibuf.h"
#include "log0buf.h"
#include "srv0srv.h"
#include "clone0api.h"
#include "dict0mem.h"
#include "fsp0sysspace.h"
#include "srv0start.h"
#include "trx0purge.h"
#include "dd/types/tablespace.h"
#include "mysqld.h"
#include "sql/dd/dictionary.h"
#include "sql_backup_lock.h"
#include "sql_thd_internal_api.h"
#include "thd_raii.h"
#include "transaction.h"
#include "ut0stage.h"
Functions | |
static void | fsp_free_extent (const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr) |
Returns an extent to the free list of a space. More... | |
static bool | xdes_in_segment (const xdes_t *descr, ib_id_t seg_id, mtr_t *mtr) |
Determine if extent belongs to a given segment. More... | |
static void | fseg_mark_page_used (space_id_t space_id, const page_size_t &page_size, fseg_inode_t *seg_inode, page_no_t page, xdes_t *descr, mtr_t *mtr) |
Marks a page used. More... | |
static xdes_t * | fseg_get_first_extent (fseg_inode_t *inode, space_id_t space_id, const page_size_t &page_size, mtr_t *mtr) |
Returns the first extent descriptor for a segment. More... | |
static UNIV_COLD void | fsp_fill_free_list (bool init_space, fil_space_t *space, fsp_header_t *header, mtr_t *mtr) |
Put new extents to the free list if there are free extents above the free limit. More... | |
static buf_block_t * | fseg_alloc_free_page_low (fil_space_t *space, const page_size_t &page_size, fseg_inode_t *seg_inode, page_no_t hint, byte direction, rw_lock_type_t rw_latch, mtr_t *mtr, mtr_t *init_mtr, bool has_done_reservation) |
Allocates a single free page from a segment. More... | |
ib_id_t | xdes_get_segment_id (const xdes_t *descr) |
Get the segment identifier to which the extent belongs to. More... | |
ib_id_t | xdes_get_segment_id (const xdes_t *descr, mtr_t *mtr) |
Get the segment identifier to which the extent belongs to. More... | |
fsp_header_t * | fsp_get_space_header_block (space_id_t id, const page_size_t &page_size, mtr_t *mtr, buf_block_t **block) |
Gets a pointer to the space header and acquires a SX lock on the page. More... | |
fsp_header_t * | fsp_get_space_header (space_id_t id, const page_size_t &page_size, mtr_t *mtr) |
Gets a pointer to the space header and acquires a SX lock on the page. More... | |
uint32_t | fsp_flags_to_dict_tf (uint32_t fsp_flags, bool compact) |
Convert a 32 bit integer tablespace flags to the 32 bit table flags. More... | |
bool | fsp_is_dd_tablespace (space_id_t space_id) |
Check if tablespace is dd tablespace. More... | |
bool | fsp_is_undo_tablespace (space_id_t space_id) |
Check whether a space id is an undo tablespace ID Undo tablespaces have space_id's starting 1 less than the redo logs. More... | |
bool | fsp_is_global_temporary (space_id_t space_id) |
Check if tablespace is global temporary. More... | |
bool | fsp_is_session_temporary (space_id_t space_id) |
Check if the tablespace is session temporary. More... | |
bool | fsp_is_system_temporary (space_id_t space_id) |
Check if tablespace is system temporary. More... | |
bool | fsp_is_checksum_disabled (space_id_t space_id) |
Check if checksum is disabled for the given space. More... | |
bool | fsp_skip_sanity_check (space_id_t space_id) |
Skip some of the sanity checks that are time consuming even in debug mode and can affect frequent verification runs that are done to ensure stability of the product. More... | |
static bool | xdes_mtr_get_bit (const xdes_t *descr, ulint bit, page_no_t offset, mtr_t *mtr) |
Gets a descriptor bit of a page. More... | |
static void | xdes_set_bit (xdes_t *descr, ulint bit, page_no_t offset, bool val, mtr_t *mtr) |
Sets a descriptor bit of a page. More... | |
static page_no_t | xdes_find_bit (xdes_t *descr, ulint bit, bool val, page_no_t hint, mtr_t *mtr) |
Looks for a descriptor bit having the desired value. More... | |
static page_no_t | xdes_get_n_used (const xdes_t *descr, mtr_t *mtr) |
Returns the number of used pages in a descriptor. More... | |
bool | xdes_state_is_valid (ulint state) |
Check if the state of extent descriptor is valid. More... | |
static bool | xdes_is_free (const xdes_t *descr, mtr_t *mtr) |
Returns true if extent contains no used pages. More... | |
static bool | xdes_is_full (const xdes_t *descr, mtr_t *mtr) |
Returns true if extent contains no free pages. More... | |
static void | xdes_set_state (xdes_t *descr, xdes_state_t state, mtr_t *mtr) |
Sets the state of an xdes. More... | |
void | xdes_set_segment_id (xdes_t *descr, const ib_id_t seg_id, xdes_state_t state, mtr_t *mtr) |
Update the segment identifier to which the extent belongs to. More... | |
static void | xdes_init (xdes_t *descr, mtr_t *mtr) |
Inits an extent descriptor to the free and clean state. More... | |
static xdes_t * | xdes_get_descriptor_with_space_hdr (fsp_header_t *sp_header, space_id_t space, page_no_t offset, mtr_t *mtr, bool init_space=false, buf_block_t **desc_block=nullptr) |
Get pointer to a the extent descriptor of a page. More... | |
static xdes_t * | xdes_get_descriptor (space_id_t space_id, page_no_t offset, const page_size_t &page_size, mtr_t *mtr) |
Gets pointer to a the extent descriptor of a page. More... | |
static xdes_t * | xdes_lst_get_descriptor (space_id_t space, const page_size_t &page_size, fil_addr_t lst_node, mtr_t *mtr) |
Gets pointer to a the extent descriptor if the file address of the descriptor list node is known. More... | |
static page_no_t | xdes_get_offset (const xdes_t *descr) |
Returns page offset of the first page in extent described by a descriptor. More... | |
static void | fsp_init_file_page_low (buf_block_t *block) |
Inits a file page whose prior contents should be ignored. More... | |
static void | fsp_space_modify_check (space_id_t id, const mtr_t *mtr) |
Assert that the mini-transaction is compatible with updating an allocation bitmap page. More... | |
static void | fsp_init_file_page (buf_block_t *block, mtr_t *mtr) |
Initialize a file page. More... | |
byte * | fsp_parse_init_file_page (byte *ptr, byte *end_ptr, buf_block_t *block) |
Parses a redo log record of a file page init. More... | |
void | fsp_init () |
Initializes the fsp system. More... | |
void | fsp_header_init_fields (page_t *page, space_id_t space_id, uint32_t flags) |
Writes the space id and flags to a tablespace header. More... | |
ulint | fsp_header_get_encryption_offset (const page_size_t &page_size) |
Get the offset of encryption information in page 0. More... | |
bool | fsp_header_write_encryption_progress (space_id_t space_id, uint32_t space_flags, ulint progress_info, byte operation_type, bool update_operation_type, mtr_t *mtr) |
Write the (un)encryption progress info into the space header. More... | |
Encryption::Progress | fsp_header_encryption_op_type_in_progress (const page_t *page, page_size_t page_size) |
Get encryption operation type in progress from the first page of a tablespace. More... | |
bool | fsp_header_write_encryption (space_id_t space_id, uint32_t space_flags, byte *encrypt_info, bool update_fsp_flags, bool rotate_encryption, mtr_t *mtr) |
Write the encryption info into the space header. More... | |
bool | fsp_header_rotate_encryption (fil_space_t *space, byte *encrypt_info, mtr_t *mtr) |
Rotate the encryption info in the space header. More... | |
bool | fsp_header_dict_get_server_version (uint *version) |
Read the server version number from the DD tablespace header. More... | |
bool | fsp_header_init (space_id_t space_id, page_no_t size, mtr_t *mtr) |
Initializes the space header of a new created space and creates also the insert buffer tree root if space == 0. More... | |
space_id_t | fsp_header_get_space_id (const page_t *page) |
Reads the space id from the first page of a tablespace. More... | |
page_size_t | fsp_header_get_page_size (const page_t *page) |
Reads the page size from the first page of a tablespace. More... | |
bool | fsp_header_get_encryption_key (uint32_t fsp_flags, Encryption_key &e_key, page_t *page) |
Reads the encryption key from the first page of a tablespace. More... | |
void | fsp_header_inc_size (space_id_t space_id, page_no_t size_inc, mtr_t *mtr) |
Increases the space size field of a space. More... | |
page_no_t | fsp_header_get_tablespace_size (void) |
Gets the size of the system tablespace from the tablespace header. More... | |
static UNIV_COLD bool | fsp_try_extend_data_file_with_pages (fil_space_t *space, page_no_t page_no, fsp_header_t *header, mtr_t *mtr) |
Try to extend a single-table tablespace so that a page would fit in the data file. More... | |
static UNIV_COLD void | adjust_undo_extend (fil_space_t *space) |
static UNIV_COLD ulint | fsp_try_extend_data_file (fil_space_t *space, fsp_header_t *header, mtr_t *mtr) |
Try to extend the last data file of a tablespace if it is auto-extending. More... | |
page_no_t | fsp_get_pages_to_extend_ibd (const page_size_t &page_size, page_no_t size) |
Calculate the number of pages to extend a datafile. More... | |
static void | fsp_init_xdes_free_frag (fsp_header_t *header, xdes_t *descr, mtr_t *mtr) |
Initialize a fragment extent and puts it into the free fragment list. More... | |
static xdes_t * | fsp_alloc_free_extent (space_id_t space_id, const page_size_t &page_size, page_no_t hint, mtr_t *mtr) |
Allocates a new free extent. More... | |
static void | fsp_alloc_from_free_frag (fsp_header_t *header, xdes_t *descr, page_no_t bit, mtr_t *mtr) |
Allocates a single free page from a space. More... | |
static buf_block_t * | fsp_page_create (const page_id_t &page_id, const page_size_t &page_size, rw_lock_type_t rw_latch, mtr_t *mtr, mtr_t *init_mtr) |
Gets a buffer block for an allocated page. More... | |
static buf_block_t * | fsp_alloc_free_page (space_id_t space, const page_size_t &page_size, page_no_t hint, rw_lock_type_t rw_latch, mtr_t *mtr, mtr_t *init_mtr) |
Allocates a single free page from a space. More... | |
static void | fsp_free_page (const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr) |
Frees a single page of a space. More... | |
static fseg_inode_t * | fsp_seg_inode_page_get_nth_inode (page_t *page, page_no_t i, const page_size_t &page_size, mtr_t *mtr) |
Returns the nth inode slot on an inode page. More... | |
static page_no_t | fsp_seg_inode_page_find_used (page_t *page, const page_size_t &page_size, mtr_t *mtr) |
Looks for a used segment inode on a segment inode page. More... | |
static page_no_t | fsp_seg_inode_page_find_free (page_t *page, page_no_t i, const page_size_t &page_size, mtr_t *mtr) |
Looks for an unused segment inode on a segment inode page. More... | |
static bool | fsp_alloc_seg_inode_page (fsp_header_t *space_header, mtr_t *mtr) |
Allocates a new file segment inode page. More... | |
static fseg_inode_t * | fsp_alloc_seg_inode (fsp_header_t *space_header, mtr_t *mtr) |
Allocates a new file segment inode. More... | |
static void | fsp_free_seg_inode (space_id_t space, const page_size_t &page_size, fseg_inode_t *inode, mtr_t *mtr) |
Frees a file segment inode. More... | |
static fseg_inode_t * | fseg_inode_try_get (const fseg_header_t *header, space_id_t space, const page_size_t &page_size, mtr_t *mtr, buf_block_t **block) |
Returns the file segment inode, page x-latched. More... | |
fseg_inode_t * | fseg_inode_get (const fseg_header_t *header, space_id_t space, const page_size_t &page_size, mtr_t *mtr, buf_block_t **block) |
Returns the file segment inode, page x-latched. More... | |
static page_no_t | fseg_get_nth_frag_page_no (fseg_inode_t *inode, ulint n, mtr_t *mtr) |
Gets the page number from the nth fragment page slot. More... | |
static void | fseg_set_nth_frag_page_no (fseg_inode_t *inode, ulint n, page_no_t page_no, mtr_t *mtr) |
Sets the page number in the nth fragment page slot. More... | |
static ulint | fseg_find_free_frag_page_slot (fseg_inode_t *inode, mtr_t *mtr) |
Finds a fragment page slot which is free. More... | |
static ulint | fseg_find_last_used_frag_page_slot (fseg_inode_t *inode, mtr_t *mtr) |
Finds a fragment page slot which is used and last in the array. More... | |
static ulint | fseg_get_n_frag_pages (fseg_inode_t *inode, mtr_t *mtr) |
Calculates reserved fragment page slots. More... | |
buf_block_t * | fseg_create_general (space_id_t space_id, page_no_t page, ulint byte_offset, bool has_done_reservation, mtr_t *mtr) |
Creates a new segment. More... | |
buf_block_t * | fseg_create (space_id_t space, page_no_t page, ulint byte_offset, mtr_t *mtr) |
Creates a new segment. More... | |
static ulint | fseg_n_reserved_pages_low (space_id_t space_id, const page_size_t &page_size, fseg_inode_t *inode, ulint *used, mtr_t *mtr) |
Calculates the number of pages reserved by a segment, and how many pages are currently used. More... | |
ulint | fseg_n_reserved_pages (fseg_header_t *header, ulint *used, mtr_t *mtr) |
Calculates the number of pages reserved by a segment, and how many pages are currently used. More... | |
static void | fseg_fill_free_list (fseg_inode_t *inode, space_id_t space, const page_size_t &page_size, page_no_t hint, mtr_t *mtr) |
Tries to fill the free list of a segment with consecutive free extents. More... | |
static bool | xdes_is_leasable (const xdes_t *descr, const page_size_t &page_size, mtr_t *mtr) |
A fragment extent can be leased if it is the special kind that has a descriptor page and no other pages are being used except the descriptor and ibuf bitmap pages. More... | |
static xdes_t * | fsp_get_last_free_frag_extent (fsp_header_t *header, const page_size_t &page_size, mtr_t *mtr) |
Get the extent descriptor of the last fragmented extent from the free_frag list. More... | |
static xdes_t * | fsp_alloc_xdes_free_frag (space_id_t space, fseg_inode_t *inode, const page_size_t &page_size, mtr_t *mtr) |
Allocate an extent from free fragment extent to a segment. More... | |
static xdes_t * | fseg_alloc_free_extent (fseg_inode_t *inode, space_id_t space, const page_size_t &page_size, mtr_t *mtr) |
Allocates a free extent for the segment: looks first in the free list of the segment, then tries to allocate from the space free list. More... | |
buf_block_t * | fseg_alloc_free_page_general (fseg_header_t *seg_header, page_no_t hint, byte direction, bool has_done_reservation, mtr_t *mtr, mtr_t *init_mtr) |
Allocates a single free page from a segment. More... | |
static bool | fsp_reserve_free_pages (fil_space_t *space, fsp_header_t *space_header, page_no_t size, mtr_t *mtr, page_no_t n_pages) |
Check that we have at least n_pages frag pages free in the first extent of a single-table tablespace, and they are also physically initialized to the data file. More... | |
bool | fsp_reserve_free_extents (ulint *n_reserved, space_id_t space_id, ulint n_ext, fsp_reserve_t alloc_type, mtr_t *mtr, page_no_t n_pages) |
Reserves free pages from a tablespace. More... | |
uintmax_t | fsp_get_available_space_in_free_extents (space_id_t space_id) |
Calculate how many KiB of new data we will be able to insert to the tablespace without running out of space. More... | |
uintmax_t | fsp_get_available_space_in_free_extents (const fil_space_t *space) |
Calculate how many KiB of new data we will be able to insert to the tablespace without running out of space. More... | |
static void | fseg_free_page_low (fseg_inode_t *seg_inode, const page_id_t &page_id, const page_size_t &page_size, bool ahi, mtr_t *mtr) |
Frees a single page of a segment. More... | |
void | fseg_free_page (fseg_header_t *seg_header, space_id_t space_id, page_no_t page, bool ahi, mtr_t *mtr) |
Frees a single page of a segment. More... | |
bool | fseg_page_is_free (fseg_header_t *seg_header, space_id_t space_id, page_no_t page) |
Checks if a single page of a segment is free. More... | |
static void | fseg_free_extent (fseg_inode_t *seg_inode, space_id_t space, const page_size_t &page_size, page_no_t page, bool ahi, mtr_t *mtr) |
Frees an extent of a segment to the space free list. More... | |
bool | fseg_free_step (fseg_header_t *header, bool ahi, mtr_t *mtr) |
Frees part of a segment. More... | |
bool | fseg_free_step_not_header (fseg_header_t *header, bool ahi, mtr_t *mtr) |
Frees part of a segment. More... | |
page_no_t | fsp_sdi_get_root_page_num (space_id_t space, const page_size_t &page_size, mtr_t *mtr) |
Retrieve tablespace dictionary index root page number stored in the page 0. More... | |
void | fsp_sdi_write_root_to_page (page_t *page, const page_size_t &page_size, page_no_t root_page_num, mtr_t *mtr) |
Write SDI Index root page num to page 0 of tablespace. More... | |
std::ostream & | xdes_page_print (std::ostream &out, const page_t *xdes, page_no_t page_no, mtr_t *mtr) |
Print the extent descriptor page in user-friendly format. More... | |
bool | fsp_check_tablespace_size (space_id_t space_id) |
Check if the tablespace size information is valid. More... | |
dberr_t | fsp_has_sdi (space_id_t space_id) |
Determine if the tablespace has SDI. More... | |
static void | mark_all_page_dirty_in_tablespace (THD *thd, space_id_t space_id, uint32_t space_flags, page_no_t total_pages, page_no_t from_page) |
Mark all pages in tablespace dirty. More... | |
static uint32_t | get_encryption_progress (fil_space_t *space, byte &operation) |
Get the encryption progress by reading header page. More... | |
static dberr_t | encrypt_begin_persist (fil_space_t *space) |
Initialize space encrypt operation and persist in page-0. More... | |
static void | encrypt_begin_memory (fil_space_t *space) |
Initialize space encrypt memory flags. More... | |
static void | process_all_pages (THD *thd, fil_space_t *space, page_no_t from_page) |
Force all pages of a space to be loaded and flushed back to disk. More... | |
static void | encrypt_end (fil_space_t *space) |
Finish space encrypt operation. More... | |
static Encryption::Resume_point | encrypt_resume_point (fil_space_t *space, page_no_t &from_page) |
Find out the place to resume the operation. More... | |
static dberr_t | encrypt_tablespace (THD *thd, space_id_t space_id, bool resume) |
Encrypt all pages of a tablespace. More... | |
static dberr_t | decrypt_begin_persist (fil_space_t *space) |
Initialize space decrypt operation and persist in page-0. More... | |
static void | decrypt_begin_memory (fil_space_t *space) |
Initialize space decrypt memory flags. More... | |
static dberr_t | decrypt_end (fil_space_t *space) |
Finish space decrypt operation. More... | |
static Encryption::Resume_point | decrypt_resume_point (fil_space_t *space, page_no_t &from_page) |
Find out the place to resume the operation. More... | |
static dberr_t | decrypt_tablespace (THD *thd, space_id_t space_id, bool resume) |
Decrypt all pages of a tablespace. More... | |
dberr_t | fsp_alter_encrypt_tablespace (THD *thd, space_id_t space_id, bool to_encrypt, void *dd_space_in) |
Encrypt/Unencrypt a tablespace. More... | |
static void | validate_tablespace_encryption (fil_space_t *space) |
Validate tablespace encryption settings. More... | |
static bool | load_encryption_from_header (fil_space_t *space) |
Load encryption info from header page. More... | |
static const std::string | enc ("ENCRYPTION") |
static const std::string | dec ("DECRYPTION") |
static const std::string | none ("NONE") |
static const std::string & | get_encryption_op_str (Encryption::Progress op) |
static void | resume_alter_encrypt_tablespace (THD *thd) |
Resume Encrypt/Decrypt for tablespace(s) post recovery. More... | |
void | fsp_init_resume_alter_encrypt_tablespace () |
Initiate roll-forward of alter encrypt in background thread. More... | |
Variables | |
double | fseg_reserve_pct = FSEG_RESERVE_PCT_DFLT |
The segment_reserve_factor is the ratio x/y expressed in percentage, where x is the number of free pages in the segment, and y is the total number of pages in the segment. More... | |
std::vector< DDL_Record * > | ts_encrypt_ddl_records |
DDL records for tablespace (un)encryption. More... | |
std::vector< space_id_t > | flag_mismatch_spaces |
constexpr uint32_t | PAGE_GROUP_SIZE = 1 |
Group of pages to be marked dirty together during (un)encryption. More... | |
File space management.
Created 11/29/1995 Heikki Tuuri
|
static |
|
static |
|
static |
Initialize space decrypt memory flags.
[in,out] | space | innodb tablespace |
|
static |
Initialize space decrypt operation and persist in page-0.
[in,out] | space | innodb tablespace |
|
static |
Finish space decrypt operation.
[in,out] | space | innodb tablespace |
|
static |
Find out the place to resume the operation.
[in,out] | space | innodb tablespace |
[out] | from_page | page number to resume from |
|
static |
Decrypt all pages of a tablespace.
[in,out] | thd | server session THD |
[in] | space_id | Tablespace id |
[in] | resume | true if resumed after server restart |
|
static |
|
static |
Initialize space encrypt memory flags.
[in,out] | space | innodb tablespace |
|
static |
Initialize space encrypt operation and persist in page-0.
[in,out] | space | innodb tablespace |
|
static |
Finish space encrypt operation.
[in,out] | space | innodb tablespace |
|
static |
Find out the place to resume the operation.
[in,out] | space | innodb tablespace |
[out] | from_page | page number to resume from |
|
static |
Encrypt all pages of a tablespace.
[in,out] | thd | server session THD |
[in] | space_id | Tablespace id |
[in] | resume | true if resumed after server restart |
|
static |
Allocates a free extent for the segment: looks first in the free list of the segment, then tries to allocate from the space free list.
NOTE that the extent returned still resides in the segment free list, it is not yet taken off it!
[in] | inode | Segment inode |
[in] | space | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
NULL | if no page could be allocated |
block | rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr), returned block is not allocated nor initialized otherwise |
buf_block_t * fseg_alloc_free_page_general | ( | fseg_header_t * | seg_header, |
page_no_t | hint, | ||
byte | direction, | ||
bool | has_done_reservation, | ||
mtr_t * | mtr, | ||
mtr_t * | init_mtr | ||
) |
Allocates a single free page from a segment.
This function implements the intelligent allocation strategy which tries to minimize file space fragmentation.
[in,out] | seg_header | Segment header |
[in] | hint | Hint of which page would be desirable |
[in,out] | direction | If the new page is needed because of an index page split, and records are inserted there in order, into which direction they go alphabetically: fsp_down, fsp_up, fsp_no_dir |
[in] | has_done_reservation | True if the caller has already done the reservation for the page with fsp_reserve_free_extents, then there is no need to do the check for this individual page |
[in,out] | mtr | Mini-transaction |
[in,out] | init_mtr | mtr or another mini-transaction in which the page should be initialized. if init_mtr!=mtr, but the page is already latched in mtr, do not initialize the page. |
NULL | if no page could be allocated |
block,rw_lock_x_lock_count(&block->lock) | == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr), returned block is not allocated nor initialized otherwise |
|
static |
Allocates a single free page from a segment.
This function implements the intelligent allocation strategy which tries to minimize file space fragmentation.
[in,out] | space | Tablespace |
[in] | page_size | Page size |
[in,out] | seg_inode | Segment inode |
[in] | hint | Hint of which page would be desirable |
[in] | direction | If the new page is needed because of an index page split, and records are inserted there in order, into which direction they go alphabetically: FSP_DOWN, FSP_UP, FSP_NO_DIR |
[in] | rw_latch | RW_SX_LATCH, RW_X_LATCH |
[in,out] | mtr | Mini-transaction |
[in,out] | init_mtr | mtr or another mini-transaction in which the page should be initialized. If init_mtr != mtr, but the page is already latched in mtr, do not initialize the page |
[in] | has_done_reservation | true if the space has already been reserved, in this case we will never return NULL |
NULL | if no page could be allocated |
block | rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr), returned block is not allocated nor initialized otherwise |
< extent of the hinted page
< the allocated page offset, FIL_NULL if could not be allocated
< the extent of the allocated page
buf_block_t * fseg_create | ( | space_id_t | space, |
page_no_t | page, | ||
ulint | byte_offset, | ||
mtr_t * | mtr | ||
) |
Creates a new segment.
space | in: space id |
page | in: page where the segment header is placed: if this is != 0, the page must belong to another segment, if this is 0, a new page will be allocated and it will belong to the created segment |
byte_offset | in: byte offset of the created segment header on the page |
mtr | in/out: mini-transaction |
buf_block_t * fseg_create_general | ( | space_id_t | space_id, |
page_no_t | page, | ||
ulint | byte_offset, | ||
bool | has_done_reservation, | ||
mtr_t * | mtr | ||
) |
Creates a new segment.
space_id | in: space id |
page | in: page where the segment header is placed: if this is != 0, the page must belong to another segment, if this is 0, a new page will be allocated and it will belong to the created segment |
byte_offset | in: byte offset of the created segment header on the page |
has_done_reservation | in: true if the caller has already done the reservation for the pages with fsp_reserve_free_extents (at least 2 extents: one for the inode and the other for the segment) then there is no need to do the check for this individual operation |
mtr | in/out: mini-transaction |
|
static |
Tries to fill the free list of a segment with consecutive free extents.
This happens if the segment is big enough to allow extents in the free list, the free list is empty, and the extents can be allocated consecutively from the hint onward.
[in] | inode | Segment inode |
[in] | space | Space id |
[in] | page_size | Page size |
[in] | hint | Hint which extent would be good as the first extent |
[in,out] | mtr | Mini-transaction |
|
static |
Finds a fragment page slot which is free.
inode | in: segment inode |
mtr | in/out: mini-transaction |
|
static |
Finds a fragment page slot which is used and last in the array.
inode | in: segment inode |
mtr | in/out: mini-transaction |
|
static |
Frees an extent of a segment to the space free list.
[in] | seg_inode | Segment inode |
[in] | space | Space id |
[in] | page | A page in the extent |
[in] | page_size | Page size |
[in] | ahi | Whether we may need to drop the adaptive hash index |
[in,out] | mtr | Mini-transaction |
void fseg_free_page | ( | fseg_header_t * | seg_header, |
space_id_t | space_id, | ||
page_no_t | page, | ||
bool | ahi, | ||
mtr_t * | mtr | ||
) |
Frees a single page of a segment.
[in] | seg_header | Segment header |
[in] | space_id | Space id |
[in] | page | Page offset |
[in] | ahi | Whether we may need to drop the adaptive hash index |
[in,out] | mtr | Mini-transaction |
|
static |
Frees a single page of a segment.
[in] | seg_inode | Segment inode |
[in] | page_id | Page id |
[in] | page_size | Page size |
[in] | ahi | Whether we may need to drop the adaptive hash index |
[in,out] | mtr | Mini-transaction |
bool fseg_free_step | ( | fseg_header_t * | header, |
bool | ahi, | ||
mtr_t * | mtr | ||
) |
Frees part of a segment.
This function can be used to free a segment by repeatedly calling this function in different mini-transactions. Doing the freeing in a single mini-transaction might result in too big a mini-transaction.
header | in, own: segment header; NOTE: if the header resides on the first page of the frag list of the segment, this pointer becomes obsolete after the last freeing step |
ahi | in: whether we may need to drop the adaptive hash index |
mtr | in/out: mini-transaction |
bool fseg_free_step_not_header | ( | fseg_header_t * | header, |
bool | ahi, | ||
mtr_t * | mtr | ||
) |
Frees part of a segment.
Differs from fseg_free_step because this function leaves the header page unfreed.
header | in: segment header which must reside on the first fragment page of the segment |
ahi | in: whether we may need to drop the adaptive hash index |
mtr | in/out: mini-transaction |
|
static |
Returns the first extent descriptor for a segment.
We think of the extent lists of the segment catenated in the order FSEG_FULL -> FSEG_NOT_FULL -> FSEG_FREE.
[in] | inode | Segment inode |
[in] | space_id | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
static |
Calculates reserved fragment page slots.
inode | in: segment inode |
mtr | in/out: mini-transaction |
|
inlinestatic |
Gets the page number from the nth fragment page slot.
inode | in: segment inode |
n | in: slot index |
mtr | in/out: mini-transaction |
fseg_inode_t * fseg_inode_get | ( | const fseg_header_t * | header, |
space_id_t | space, | ||
const page_size_t & | page_size, | ||
mtr_t * | mtr, | ||
buf_block_t ** | block = nullptr |
||
) |
Returns the file segment inode, page x-latched.
[in] | header | Segment header |
[in] | space | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
[out] | block | Inode block |
|
static |
Returns the file segment inode, page x-latched.
[in] | header | Segment header |
[in] | space | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
[out] | block | Inode block, or NULL to ignore |
|
static |
Marks a page used.
The page must reside within the extents of the given segment.
[in] | space_id | Tablespace identifier |
[in] | page_size | Size of each page in the tablespace. |
[in] | seg_inode | The file segment inode pointer |
[in] | page | The page number to be marked as used. |
[in] | descr | Extent descriptor containing information about page. |
[in] | mtr | Mini-transaction context for modification. |
ulint fseg_n_reserved_pages | ( | fseg_header_t * | header, |
ulint * | used, | ||
mtr_t * | mtr | ||
) |
Calculates the number of pages reserved by a segment, and how many pages are currently used.
header | in: segment header |
used | out: number of pages used (<= reserved) |
mtr | in/out: mini-transaction |
|
static |
Calculates the number of pages reserved by a segment, and how many pages are currently used.
[in] | space_id | Unique tablespace identifier |
[in] | page_size | Size of each page in the tablespace. |
[in] | inode | File segment inode pointer |
[out] | used | Number of pages used (not more than reserved) |
[in,out] | mtr | Mini-transaction |
bool fseg_page_is_free | ( | fseg_header_t * | seg_header, |
space_id_t | space_id, | ||
page_no_t | page | ||
) |
Checks if a single page of a segment is free.
seg_header | in: segment header |
space_id | in: space id |
page | in: page offset |
|
inlinestatic |
Sets the page number in the nth fragment page slot.
inode | in: segment inode |
n | in: slot index |
page_no | in: page number to set |
mtr | in/out: mini-transaction |
|
static |
Allocates a new free extent.
[in] | space_id | Tablespace identifier |
[in] | page_size | Page size |
[in] | hint | Hint of which extent would be desirable: any page offset in the extent goes; the hint must not be > FSP_FREE_LIMIT |
[in,out] | mtr | Mini-transaction |
|
static |
Allocates a single free page from a space.
The page is marked as used.
[in] | space | Space id |
[in] | page_size | Page size |
[in] | hint | Hint of which page would be desirable |
[in] | rw_latch | RW_SX_LATCH, RW_X_LATCH |
[in,out] | mtr | Mini-transaction |
[in,out] | init_mtr | Mini-transaction in which the page should be initialized (may be the same as mtr) |
NULL | if no page could be allocated |
block | rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr), returned block is not allocated nor initialized otherwise |
|
static |
Allocates a single free page from a space.
header | in/out: tablespace header |
descr | in/out: extent descriptor |
bit | in: slot to allocate in the extent |
mtr | in/out: mini-transaction |
|
static |
Allocates a new file segment inode.
space_header | in: space header |
mtr | in/out: mini-transaction |
|
static |
Allocates a new file segment inode page.
space_header | in: space header |
mtr | in/out: mini-transaction |
|
static |
Allocate an extent from free fragment extent to a segment.
[in] | space | Space id |
[in,out] | inode | Segment to which extent is leased |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
dberr_t fsp_alter_encrypt_tablespace | ( | THD * | thd, |
space_id_t | space_id, | ||
bool | to_encrypt, | ||
void * | dd_space_in | ||
) |
Encrypt/Unencrypt a tablespace.
[in] | thd | current thread |
[in] | space_id | Tablespace id |
[in] | to_encrypt | true if to encrypt, false if to decrypt |
[in,out] | dd_space_in | dd tablespace object |
bool fsp_check_tablespace_size | ( | space_id_t | space_id | ) |
Check if the tablespace size information is valid.
[in] | space_id | the tablespace identifier |
|
static |
Put new extents to the free list if there are free extents above the free limit.
If an extent happens to contain an extent descriptor page, the extent is put to the FSP_FREE_FRAG list with the page marked as used.
[in] | init_space | True if this is a single-table tablespace and we are only initializing the first extent and the first bitmap pages; then we will not allocate more extents |
[in,out] | space | Tablespace |
[in,out] | header | Tablespace header |
[in,out] | mtr | Mini-transaction |
uint32_t fsp_flags_to_dict_tf | ( | uint32_t | fsp_flags, |
bool | compact | ||
) |
Convert a 32 bit integer tablespace flags to the 32 bit table flags.
This can only be done for a tablespace that was built as a file-per-table tablespace. Note that the fsp_flags cannot show the difference between a Compact and Redundant table, so an extra Compact boolean must be supplied. Low order bit | REDUNDANT | COMPACT | COMPRESSED | DYNAMIC fil_space_t::flags | 0 | 0 | 1 | 1 dict_table_t::flags | 0 | 1 | 1 | 1
[in] | fsp_flags | fil_space_t::flags |
[in] | compact | true if not Redundant row format |
|
static |
Returns an extent to the free list of a space.
[in] | page_id | Page id in the extent |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
static |
Frees a single page of a space.
The page is marked as free and clean.
[in] | page_id | Page id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
static |
Frees a file segment inode.
[in] | space | Space id |
[in] | page_size | Page size |
[in,out] | inode | Segment inode |
[in,out] | mtr | Mini-transaction |
uintmax_t fsp_get_available_space_in_free_extents | ( | const fil_space_t * | space | ) |
Calculate how many KiB of new data we will be able to insert to the tablespace without running out of space.
Start with a space object that has been acquired by the caller who holds it for the calculation,
[in] | space | tablespace object from fil_space_acquire() |
uintmax_t fsp_get_available_space_in_free_extents | ( | space_id_t | space_id | ) |
Calculate how many KiB of new data we will be able to insert to the tablespace without running out of space.
[in] | space_id | tablespace ID |
UINTMAX_MAX | if unknown |
|
static |
Get the extent descriptor of the last fragmented extent from the free_frag list.
[in] | header | Tablespace header |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
page_no_t fsp_get_pages_to_extend_ibd | ( | const page_size_t & | page_size, |
page_no_t | size | ||
) |
Calculate the number of pages to extend a datafile.
We extend single-table and general tablespaces first one extent at a time, but 4 at a time for bigger tablespaces. It is not enough to extend always by one extent, because we need to add at least one extent to FSP_FREE. A single extent descriptor page will track many extents. And the extent that uses its extent descriptor page is put onto the FSP_FREE_FRAG list. Extents that do not use their extent descriptor page are added to FSP_FREE. The physical page size is used to determine how many extents are tracked on one extent descriptor page. See xdes_calc_descriptor_page().
[in] | page_size | page_size of the datafile |
[in] | size | current number of pages in the datafile |
fsp_header_t * fsp_get_space_header | ( | space_id_t | id, |
const page_size_t & | page_size, | ||
mtr_t * | mtr | ||
) |
Gets a pointer to the space header and acquires a SX lock on the page.
[in] | id | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
fsp_header_t * fsp_get_space_header_block | ( | space_id_t | id, |
const page_size_t & | page_size, | ||
mtr_t * | mtr, | ||
buf_block_t ** | block | ||
) |
Gets a pointer to the space header and acquires a SX lock on the page.
[in] | id | Space id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
[out] | block | Block |
dberr_t fsp_has_sdi | ( | space_id_t | space_id | ) |
Determine if the tablespace has SDI.
[in] | space_id | Tablespace id |
bool fsp_header_dict_get_server_version | ( | uint * | version | ) |
Read the server version number from the DD tablespace header.
[out] | version | server version from tablespace header |
Encryption::Progress fsp_header_encryption_op_type_in_progress | ( | const page_t * | page, |
page_size_t | page_size | ||
) |
Get encryption operation type in progress from the first page of a tablespace.
[in] | page | first page of a tablespace |
[in] | page_size | tablespace page size |
bool fsp_header_get_encryption_key | ( | uint32_t | fsp_flags, |
Encryption_key & | e_key, | ||
page_t * | page | ||
) |
Reads the encryption key from the first page of a tablespace.
[in] | fsp_flags | tablespace flags |
[in,out] | e_key | tablespace key, iv |
[in] | page | first page of a tablespace |
ulint fsp_header_get_encryption_offset | ( | const page_size_t & | page_size | ) |
Get the offset of encryption information in page 0.
[in] | page_size | page size. |
page_size_t fsp_header_get_page_size | ( | const page_t * | page | ) |
Reads the page size from the first page of a tablespace.
[in] | page | first page of a tablespace |
space_id_t fsp_header_get_space_id | ( | const page_t * | page | ) |
Reads the space id from the first page of a tablespace.
page | in: first page of a tablespace |
page_no_t fsp_header_get_tablespace_size | ( | void | ) |
Gets the size of the system tablespace from the tablespace header.
If we do not have an auto-extending data file, this should be equal to the size of the data files. If there is an auto-extending data file, this can be smaller.
void fsp_header_inc_size | ( | space_id_t | space_id, |
page_no_t | size_inc, | ||
mtr_t * | mtr | ||
) |
Increases the space size field of a space.
[in] | space_id | Space id |
[in] | size_inc | Size increment in pages |
[in,out] | mtr | Mini-transaction |
bool fsp_header_init | ( | space_id_t | space_id, |
page_no_t | size, | ||
mtr_t * | mtr | ||
) |
Initializes the space header of a new created space and creates also the insert buffer tree root if space == 0.
[in] | space_id | Space id |
[in] | size | Current size in blocks |
[in,out] | mtr | Mini-transaction |
void fsp_header_init_fields | ( | page_t * | page, |
space_id_t | space_id, | ||
uint32_t | flags | ||
) |
Writes the space id and flags to a tablespace header.
The flags contain row type, physical/compressed page size, and logical/uncompressed page size of the tablespace.
page | in/out: first page in the space |
space_id | in: space id |
flags | in: tablespace flags (FSP_SPACE_FLAGS) |
bool fsp_header_rotate_encryption | ( | fil_space_t * | space, |
byte * | encrypt_info, | ||
mtr_t * | mtr | ||
) |
Rotate the encryption info in the space header.
[in] | space | Tablespace |
[in] | encrypt_info | Buffer for re-encrypt key. |
[in,out] | mtr | Mini-transaction |
bool fsp_header_write_encryption | ( | space_id_t | space_id, |
uint32_t | space_flags, | ||
byte * | encrypt_info, | ||
bool | update_fsp_flags, | ||
bool | rotate_encryption, | ||
mtr_t * | mtr | ||
) |
Write the encryption info into the space header.
[in] | space_id | Tablespace id |
[in] | space_flags | Tablespace flags |
[in] | encrypt_info | Buffer for re-encrypt key |
[in] | update_fsp_flags | If it need to update the space flags |
[in] | rotate_encryption | If it is called during key rotation |
[in,out] | mtr | Mini-transaction |
bool fsp_header_write_encryption_progress | ( | space_id_t | space_id, |
uint32_t | space_flags, | ||
ulint | progress_info, | ||
byte | operation_type, | ||
bool | update_operation_type, | ||
mtr_t * | mtr | ||
) |
Write the (un)encryption progress info into the space header.
[in] | space_id | Tablespace id |
[in] | space_flags | Tablespace flags |
[in] | progress_info | Max pages (un)encrypted |
[in] | operation_type | Type of operation |
[in] | update_operation_type | Is operation to be updated |
[in,out] | mtr | Mini-transaction |
void fsp_init | ( | void | ) |
Initializes the fsp system.
Initializes the file space system.
|
static |
Initialize a file page.
[in,out] | block | File page |
[in,out] | mtr | Mini-transaction |
|
static |
Inits a file page whose prior contents should be ignored.
block | in: pointer to a page |
void fsp_init_resume_alter_encrypt_tablespace | ( | ) |
Initiate roll-forward of alter encrypt in background thread.
|
static |
Initialize a fragment extent and puts it into the free fragment list.
[in,out] | header | Tablespace header |
[in,out] | descr | Extent descriptor |
[in,out] | mtr | Mini-transaction |
bool fsp_is_checksum_disabled | ( | space_id_t | space_id | ) |
Check if checksum is disabled for the given space.
[in] | space_id | tablespace ID |
bool fsp_is_dd_tablespace | ( | space_id_t | space_id | ) |
Check if tablespace is dd tablespace.
[in] | space_id | tablespace ID |
bool fsp_is_global_temporary | ( | space_id_t | space_id | ) |
Check if tablespace is global temporary.
[in] | space_id | tablespace ID |
bool fsp_is_session_temporary | ( | space_id_t | space_id | ) |
Check if the tablespace is session temporary.
[in] | space_id | tablespace ID |
bool fsp_is_system_temporary | ( | space_id_t | space_id | ) |
Check if tablespace is system temporary.
[in] | space_id | tablespace ID |
bool fsp_is_undo_tablespace | ( | space_id_t | space_id | ) |
Check whether a space id is an undo tablespace ID Undo tablespaces have space_id's starting 1 less than the redo logs.
They are numbered down from this. Since rseg_id=0 always refers to the system tablespace, undo_space_num values start at 1. The current limit is 127. The translation from an undo_space_num is: undo space_id = log_first_space_id - undo_space_num
[in] | space_id | space id to check |
|
static |
Gets a buffer block for an allocated page.
NOTE: If init_mtr != mtr, the block will only be initialized if it was not previously x-latched. It is assumed that the block has been x-latched only by mtr, and freed in mtr in that case.
[in] | page_id | Page id of the allocated page |
[in] | page_size | Page size of the allocated page |
[in] | rw_latch | RW_SX_LATCH, RW_X_LATCH |
[in,out] | mtr | Mini-transaction of the allocation |
[in,out] | init_mtr | Mini-transaction for initializing the page |
byte * fsp_parse_init_file_page | ( | byte * | ptr, |
byte * | end_ptr, | ||
buf_block_t * | block | ||
) |
Parses a redo log record of a file page init.
[in] | ptr | Buffer. |
[in] | end_ptr | Buffer end. |
[in] | block | Block or nullptr. |
bool fsp_reserve_free_extents | ( | ulint * | n_reserved, |
space_id_t | space_id, | ||
ulint | n_ext, | ||
fsp_reserve_t | alloc_type, | ||
mtr_t * | mtr, | ||
page_no_t | n_pages | ||
) |
Reserves free pages from a tablespace.
All mini-transactions which may use several pages from the tablespace should call this function beforehand and reserve enough free extents so that they certainly will be able to do their operation, like a B-tree page split, fully. Reservations must be released with function fil_space_release_free_extents!
The alloc_type below has the following meaning: FSP_NORMAL means an operation which will probably result in more space usage, like an insert in a B-tree; FSP_UNDO means allocation to undo logs: if we are deleting rows, then this allocation will in the long run result in less space usage (after a purge); FSP_CLEANING means allocation done in a physical record delete (like in a purge) or other cleaning operation which will result in less space usage in the long run. We prefer the latter two types of allocation: when space is scarce, FSP_NORMAL allocations will not succeed, but the latter two allocations will succeed, if possible. The purpose is to avoid dead end where the database is full but the user cannot free any space because these freeing operations temporarily reserve some space.
Single-table tablespaces whose size is < FSP_EXTENT_SIZE pages are a special case. In this function we would liberally reserve several extents for every page split or merge in a B-tree. But we do not want to waste disk space if the table only occupies < FSP_EXTENT_SIZE pages. That is why we apply different rules in that special case, just ensuring that there are n_pages free pages available.
[out] | n_reserved | Number of extents actually reserved; if we return true and the tablespace size is < FSP_EXTENT_SIZE pages, then this can be 0, otherwise it is n_ext |
[in] | space_id | Tablespace identifier |
[in] | n_ext | Number of extents to reserve |
[in] | alloc_type | Page reservation type (FSP_BLOB, etc) |
[in,out] | mtr | Mini-transaction |
[in] | n_pages | For small tablespaces (tablespace size is less than FSP_EXTENT_SIZE), number of free pages to reserve. |
|
static |
Check that we have at least n_pages frag pages free in the first extent of a single-table tablespace, and they are also physically initialized to the data file.
That is we have already extended the data file so that those pages are inside the data file. If not, this function extends the tablespace with pages.
[in,out] | space | Tablespace |
[in,out] | space_header | Tablespace header, x-latched |
[in] | size | Size of the tablespace in pages, must be less than FSP_EXTENT_SIZE |
[in,out] | mtr | Mini-transaction |
[in] | n_pages | Number of pages to reserve |
page_no_t fsp_sdi_get_root_page_num | ( | space_id_t | space, |
const page_size_t & | page_size, | ||
mtr_t * | mtr | ||
) |
Retrieve tablespace dictionary index root page number stored in the page 0.
[in] | space | Tablespace id |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
void fsp_sdi_write_root_to_page | ( | page_t * | page, |
const page_size_t & | page_size, | ||
page_no_t | root_page_num, | ||
mtr_t * | mtr | ||
) |
Write SDI Index root page num to page 0 of tablespace.
[in,out] | page | Page 0 frame |
[in] | page_size | Size of page |
[in] | root_page_num | Root page number of SDI |
[in,out] | mtr | Mini-transaction |
|
static |
Looks for an unused segment inode on a segment inode page.
[in] | page | Segment inode page |
[in] | i | Search forward starting from this index |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
static |
Looks for a used segment inode on a segment inode page.
[in] | page | Segment inode page |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
inlinestatic |
Returns the nth inode slot on an inode page.
[in] | page | Segment inode page |
[in] | i | Inode index on page |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
bool fsp_skip_sanity_check | ( | space_id_t | space_id | ) |
Skip some of the sanity checks that are time consuming even in debug mode and can affect frequent verification runs that are done to ensure stability of the product.
|
static |
Assert that the mini-transaction is compatible with updating an allocation bitmap page.
[in] | id | Tablespace identifier |
[in] | mtr | Mini-transaction |
|
static |
Try to extend the last data file of a tablespace if it is auto-extending.
[in,out] | space | Tablespace |
[in,out] | header | Tablespace header |
[in,out] | mtr | Mini-transaction |
|
static |
Try to extend a single-table tablespace so that a page would fit in the data file.
[in,out] | space | Tablespace |
[in] | page_no | Page number |
[in,out] | header | Tablespace header |
[in,out] | mtr | Mini-transaction |
|
inlinestatic |
|
static |
Get the encryption progress by reading header page.
[in] | space | tablespace |
[out] | operation | operation which was being performed |
|
static |
Load encryption info from header page.
[in] | space | tablespace |
|
static |
Mark all pages in tablespace dirty.
[in] | thd | current thread |
[in] | space_id | tablespace id |
[in] | space_flags | tablespace flags |
[in] | total_pages | total pages in tablespace |
[in] | from_page | page number from where to start the operation |
|
static |
|
static |
Force all pages of a space to be loaded and flushed back to disk.
[in,out] | thd | server session THD |
[in,out] | space | innodb tablespace |
[in] | from_page | page number to resume from |
|
static |
Resume Encrypt/Decrypt for tablespace(s) post recovery.
If an error occurs while processing any tablespace needing encryption, post an error for that space and keep going.
[in] | thd | background thread |
|
static |
Validate tablespace encryption settings.
|
inlinestatic |
Looks for a descriptor bit having the desired value.
Starts from hint and scans upward; at the end of the extent the search is wrapped to the start of the extent.
descr | in: descriptor |
bit | in: XDES_FREE_BIT or XDES_CLEAN_BIT |
val | in: desired bit value |
hint | in: hint of which bit position would be desirable |
mtr | in/out: mini-transaction |
|
static |
Gets pointer to a the extent descriptor of a page.
The page where the extent descriptor resides is x-locked. If the page offset is equal to the free limit of the space, adds new extents from above the free limit to the space free list, if not free limit == space size. This adding is necessary to make the descriptor defined, as they are uninitialized above the free limit.
[in] | space_id | Space id |
[in] | offset | Page offset; if equal to the free limit, we try to add new extents to the space free list |
[in] | page_size | Page size |
[in,out] | mtr | Mini-transaction |
|
inlinestatic |
Get pointer to a the extent descriptor of a page.
[in,out] | sp_header | Tablespace header page, x-latched |
[in] | space | Tablespace identifier |
[in] | offset | Page offset |
[in,out] | mtr | Mini-transaction |
[in] | init_space | Whether the tablespace is being initialized |
[out] | desc_block | Descriptor block, or NULL if it is the same as the tablespace header |
Returns the number of used pages in a descriptor.
descr | in: descriptor |
mtr | in/out: mini-transaction |
Returns page offset of the first page in extent described by a descriptor.
descr | in: extent descriptor |
Get the segment identifier to which the extent belongs to.
[in] | descr | extent descriptor |
Get the segment identifier to which the extent belongs to.
[in] | descr | Extent descriptor |
[in] | mtr | Mini-transaction |
Determine if extent belongs to a given segment.
[in] | descr | Extent descriptor |
[in] | seg_id | Segment identifier |
[in] | mtr | Mini-transaction |
Inits an extent descriptor to the free and clean state.
descr | in: descriptor |
mtr | in/out: mini-transaction |
Returns true if extent contains no used pages.
descr | in: descriptor |
mtr | in/out: mini-transaction |
Returns true if extent contains no free pages.
descr | in: descriptor |
mtr | in/out: mini-transaction |
|
inlinestatic |
A fragment extent can be leased if it is the special kind that has a descriptor page and no other pages are being used except the descriptor and ibuf bitmap pages.
The number of used pages will be equal to XDES_FRAG_N_USED.
[in] | descr | Extent descriptor |
[in] | page_size | The page size |
[in,out] | mtr | Mini-transaction |
|
inlinestatic |
Gets pointer to a the extent descriptor if the file address of the descriptor list node is known.
The page where the extent descriptor resides is x-locked.
[in] | space | Space id |
[in] | page_size | Page size |
[in] | lst_node | File address of the list node contained in the descriptor |
[in,out] | mtr | Mini-transaction |
|
inlinestatic |
Gets a descriptor bit of a page.
descr | in: descriptor |
bit | in: XDES_FREE_BIT or XDES_CLEAN_BIT |
offset | in: page offset within extent: 0 ... FSP_EXTENT_SIZE - 1 |
mtr | in: mini-transaction |
std::ostream & xdes_page_print | ( | std::ostream & | out, |
const page_t * | xdes, | ||
page_no_t | page_no, | ||
mtr_t * | mtr | ||
) |
Print the extent descriptor page in user-friendly format.
[in] | out | The output file stream |
[in] | xdes | The extent descriptor page |
[in] | page_no | The page number of xdes page |
[in] | mtr | Mini-transaction. |
|
inlinestatic |
Sets a descriptor bit of a page.
descr | in: descriptor |
bit | in: XDES_FREE_BIT or XDES_CLEAN_BIT |
offset | in: page offset within extent: 0 ... FSP_EXTENT_SIZE - 1 |
val | in: bit value |
mtr | in/out: mini-transaction |
|
inline |
Update the segment identifier to which the extent belongs to.
[in,out] | descr | Extent descriptor |
[in,out] | seg_id | Segment identifier |
[in] | state | State of the extent. |
[in,out] | mtr | Mini-transaction. |
|
inlinestatic |
Sets the state of an xdes.
descr | in/out: descriptor |
state | in: state to set |
mtr | in/out: mini-transaction |
|
constexpr |
Group of pages to be marked dirty together during (un)encryption.
std::vector<DDL_Record *> ts_encrypt_ddl_records |
DDL records for tablespace (un)encryption.