MySQL 9.0.0
Source Code Documentation
|
The low-level file system. More...
#include "univ.i"
#include "dict0types.h"
#include "fil0types.h"
#include "log0recv.h"
#include "page0size.h"
#include "ibuf0types.h"
#include "ut0new.h"
#include "mysql/strings/m_ctype.h"
#include "sql/dd/object_id.h"
#include <atomic>
#include <cstdint>
#include <list>
#include <vector>
Go to the source code of this file.
Classes | |
struct | fil_node_t |
File node of a tablespace or the log data space. More... | |
struct | fil_space_t |
Tablespace or log data space. More... | |
class | Fil_path |
Wrapper for a path to a directory that may or may not exist. More... | |
struct | fil_addr_t |
File space address. More... | |
class | Fil_iterator |
Iterate over the files in all the tablespaces. More... | |
struct | PageCallback |
Callback functor. More... | |
Macros | |
#define | UNDO_INITIAL_SIZE_IN_PAGES os_offset_t { UNDO_INITIAL_SIZE / srv_page_size } |
#define | DOT_IBD dot_ext[IBD] |
#define | DOT_CFG dot_ext[CFG] |
#define | DOT_CFP dot_ext[CFP] |
#define | DOT_IBT dot_ext[IBT] |
#define | DOT_IBU dot_ext[IBU] |
#define | DOT_DWR dot_ext[DWR] |
#define | fil_block_check_type(block, type, mtr) fil_page_check_type(block->page.id, block->frame, type, mtr) |
Check (and if needed, reset) the page type. More... | |
Typedefs | |
using | Filenames = std::vector< std::string, ut::allocator< std::string > > |
using | Space_ids = std::vector< space_id_t, ut::allocator< space_id_t > > |
using | fil_faddr_t = byte |
'type' definition in C: an address stored in a file page is a string of bytes More... | |
using | page_type_t = uint16_t |
Enumerations | |
enum | fil_type_t : uint8_t { FIL_TYPE_TEMPORARY = 1 , FIL_TYPE_IMPORT = 2 , FIL_TYPE_TABLESPACE = 4 } |
File types. More... | |
enum class | Fil_state { MATCHES , MISSING , DELETED , MOVED , MOVED_PREV , RENAMED } |
Result of comparing a path. More... | |
enum | ib_file_suffix { NO_EXT = 0 , IBD = 1 , CFG = 2 , CFP = 3 , IBT = 4 , IBU = 5 , DWR = 6 , BWR = 7 } |
Common InnoDB file extensions. More... | |
Functions | |
size_t | fil_get_scan_threads (size_t num_files) |
Calculate the number of threads that can be spawned to scan the given number of files taking into the consideration, number of cores available on the machine. More... | |
std::ostream & | operator<< (std::ostream &out, const fil_addr_t &obj) |
fil_space_t * | fil_space_get (space_id_t space_id) |
Look up a tablespace. More... | |
rw_lock_t * | fil_space_get_latch (space_id_t space_id) |
Returns the latch of a file space. More... | |
fil_type_t | fil_space_get_type (space_id_t space_id) |
Gets the type of a file space. More... | |
void | fil_space_set_imported (space_id_t space_id) |
Note that a tablespace has been imported. More... | |
char * | fil_node_create (const char *name, page_no_t size, fil_space_t *space, bool is_raw, page_no_t max_pages=PAGE_NO_MAX) |
Attach a file to a tablespace. More... | |
fil_space_t * | fil_space_create (const char *name, space_id_t space_id, uint32_t flags, fil_type_t purpose) |
Create a space memory object and put it to the fil_system hash table. More... | |
bool | fil_assign_new_space_id (space_id_t *space_id) |
Assigns a new space id for a new single-table tablespace. More... | |
char * | fil_space_get_first_path (space_id_t space_id) |
Returns the path from the first fil_node_t found with this space ID. More... | |
page_no_t | fil_space_get_size (space_id_t space_id) |
Returns the size of the space in pages. More... | |
page_no_t | fil_space_get_undo_initial_size (space_id_t space_id) |
Returns the size of an undo space just after it was initialized. More... | |
void | fil_space_set_undo_size (space_id_t space_id, bool use_current) |
This is called for an undo tablespace after it has been initialized or opened. More... | |
uint32_t | fil_space_get_flags (space_id_t space_id) |
Returns the flags of the space. More... | |
void | fil_space_set_flags (fil_space_t *space, uint32_t flags) |
Sets the flags of the tablespace. More... | |
bool | fil_space_open (space_id_t space_id) |
Open each file of a tablespace if not already open. More... | |
void | fil_space_close (space_id_t space_id) |
Close each file of a tablespace if open. More... | |
const page_size_t | fil_space_get_page_size (space_id_t space_id, bool *found) |
Returns the page size of the space and whether it is compressed or not. More... | |
void | fil_init (ulint max_n_open) |
Initializes the tablespace memory cache. More... | |
bool | fil_open_files_limit_update (size_t &new_max_open_files) |
Changes the maximum opened files limit. More... | |
void | fil_close () |
Initializes the tablespace memory cache. More... | |
void | fil_open_system_tablespace_files () |
Opens all log files and system tablespace data files. More... | |
void | fil_close_all_files () |
Closes all open files. More... | |
void | fil_set_max_space_id_if_bigger (space_id_t max_id) |
Sets the max tablespace id counter if the given number is bigger than the previous value. More... | |
dberr_t | fil_write_flushed_lsn (lsn_t lsn) |
Write the flushed LSN to the page header of the first page in the system tablespace. More... | |
fil_space_t * | fil_space_acquire (space_id_t space_id) |
Acquire a tablespace when it could be dropped concurrently. More... | |
fil_space_t * | fil_space_acquire_silent (space_id_t space_id) |
Acquire a tablespace that may not exist. More... | |
void | fil_space_release (fil_space_t *space) |
Release a tablespace acquired with fil_space_acquire(). More... | |
bool | fil_system_get_file_by_space_id (space_id_t space_id, std::string &name) |
Fetch the file name opened for a space_id from the file map. More... | |
bool | fil_system_get_file_by_space_num (space_id_t space_num, space_id_t &space_id, std::string &name) |
Fetch the file name opened for an undo space number from the file map. More... | |
bool | fil_truncate_tablespace (space_id_t space_id, page_no_t size_in_pages) |
Truncate the tablespace to needed size. More... | |
dberr_t | fil_close_tablespace (space_id_t space_id) |
Closes a single-table tablespace. More... | |
dberr_t | fil_discard_tablespace (space_id_t space_id) |
Discards a single-table tablespace. More... | |
dberr_t | fil_rename_tablespace_check (space_id_t space_id, const char *old_path, const char *new_path, bool is_discarded) |
Test if a tablespace file can be renamed to a new filepath by checking if that the old filepath exists and the new filepath does not exist. More... | |
dberr_t | fil_rename_tablespace (space_id_t space_id, const char *old_path, const char *new_name, const char *new_path_in) |
Rename a single-table tablespace. More... | |
dberr_t | fil_ibd_create (space_id_t space_id, const char *name, const char *path, uint32_t flags, page_no_t size) |
Create an IBD tablespace file. More... | |
dberr_t | fil_ibt_create (space_id_t space_id, const char *name, const char *path, uint32_t flags, page_no_t size) |
Create a session temporary tablespace (IBT) file. More... | |
dberr_t | fil_delete_tablespace (space_id_t space_id, buf_remove_t buf_remove) |
Deletes an IBD or IBU tablespace. More... | |
dberr_t | fil_ibd_open (bool validate, fil_type_t purpose, space_id_t space_id, uint32_t flags, const char *space_name, const char *path_in, bool strict, bool old_space) |
Open a single-table tablespace and optionally do some validation such as checking that the space id is correct. More... | |
bool | fil_space_exists_in_mem (space_id_t space_id, const char *name, bool print_err, bool adjust_space) |
Returns true if a matching tablespace exists in the InnoDB tablespace memory cache. More... | |
void | fil_extend_tablespaces_to_stored_len () |
Extends all tablespaces to the size stored in the space header. More... | |
bool | fil_space_extend (fil_space_t *space, page_no_t size) |
Try to extend a tablespace if it is smaller than the specified size. More... | |
bool | fil_space_reserve_free_extents (space_id_t space_id, ulint n_free_now, ulint n_to_reserve) |
Tries to reserve free extents in a file space. More... | |
void | fil_space_release_free_extents (space_id_t space_id, ulint n_reserved) |
Releases free extents in a file space. More... | |
ulint | fil_space_get_n_reserved_extents (space_id_t space_id) |
Gets the number of reserved extents. More... | |
dberr_t | fil_io (const IORequest &type, bool sync, const page_id_t &page_id, const page_size_t &page_size, ulint byte_offset, ulint len, void *buf, void *message) |
Read or write data from a file. More... | |
void | fil_aio_wait (ulint segment) |
Waits for an AIO operation to complete. More... | |
void | fil_flush (space_id_t space_id) |
Flushes to disk possible writes cached by the OS. More... | |
void | fil_flush_file_spaces () |
Flush to disk the writes in file spaces possibly cached by the OS (note: spaces of type FIL_TYPE_TEMPORARY are skipped) More... | |
bool | fil_validate () |
Checks the consistency of the tablespace cache. More... | |
bool | fil_addr_is_null (const fil_addr_t &addr) |
Returns true if file address is undefined. More... | |
page_no_t | fil_page_get_prev (const byte *page) |
Get the predecessor of a file page. More... | |
page_no_t | fil_page_get_next (const byte *page) |
Get the successor of a file page. More... | |
void | fil_page_set_type (byte *page, ulint type) |
Sets the file page type. More... | |
void | fil_page_reset_type (const page_id_t &page_id, byte *page, ulint type, mtr_t *mtr) |
Reset the page type. More... | |
void | fil_page_check_type (const page_id_t &page_id, byte *page, ulint type, mtr_t *mtr) |
Check (and if needed, reset) the page type. More... | |
void | fil_space_inc_redo_skipped_count (space_id_t space_id) |
Increase redo skipped count for a tablespace. More... | |
void | fil_space_dec_redo_skipped_count (space_id_t space_id) |
Decrease redo skipped count for a tablespace. More... | |
bool | fil_space_is_redo_skipped (space_id_t space_id) |
Check whether a single-table tablespace is redo skipped. More... | |
bool | fil_delete_file (const char *path) |
Delete the tablespace file and any related files like .cfg. More... | |
dberr_t | fil_tablespace_iterate (const Encryption_metadata &encryption_metadata, dict_table_t *table, ulint n_io_buffers, Compression::Type compression_type, PageCallback &callback) |
Iterate over all the pages in the tablespace. More... | |
bool | fil_space_read_name_and_filepath (space_id_t space_id, char **name, char **filepath) |
Looks for a pre-existing fil_space_t with the given tablespace ID and, if found, returns the name and filepath in newly allocated buffers that the caller must free. More... | |
char * | fil_path_to_space_name (const char *filename) |
Convert a file name to a tablespace name. More... | |
space_id_t | fil_space_get_id_by_name (const char *name) |
Returns the space ID based on the tablespace name. More... | |
dberr_t | fil_rename_precheck (const dict_table_t *old_table, const dict_table_t *new_table, const char *tmp_name) |
Check if swapping two .ibd files can be done without failure. More... | |
dberr_t | fil_set_compression (space_id_t space_id, const char *algorithm) |
Set the compression type for the tablespace. More... | |
Compression::Type | fil_get_compression (space_id_t space_id) |
Get the compression algorithm for a tablespace. More... | |
void | fil_io_set_encryption (IORequest &req_type, const page_id_t &page_id, fil_space_t *space) |
Set encryption information for IORequest. More... | |
dberr_t | fil_set_encryption (space_id_t space_id, Encryption::Type algorithm, byte *key, byte *iv) |
Set the encryption type for the tablespace. More... | |
dberr_t | fil_set_autoextend_size (space_id_t space_id, uint64_t autoextend_size) |
Set the autoextend_size attribute for the tablespace. More... | |
dberr_t | fil_reset_encryption (space_id_t space_id) |
Reset the encryption type for the tablespace. More... | |
size_t | fil_encryption_rotate () |
Rotate the tablespace keys by new master key. More... | |
void | fil_encryption_reencrypt (std::vector< space_id_t > &sid_vector) |
Roencrypt the tablespace keys by current master key. More... | |
void | fil_space_open_if_needed (fil_space_t *space) |
During crash recovery, open a tablespace if it had not been opened yet, to get valid size and flags. More... | |
void | fil_no_punch_hole (fil_node_t *file) |
Note that the file system where the file resides doesn't support PUNCH HOLE. More... | |
fil_space_t * | fil_space_get_sys_space () |
const byte * | fil_tablespace_redo_create (const byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only) |
Redo a tablespace create. More... | |
const byte * | fil_tablespace_redo_delete (const byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only) |
Redo a tablespace delete. More... | |
const byte * | fil_tablespace_redo_rename (const byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only) |
Redo a tablespace rename. More... | |
const byte * | fil_tablespace_redo_extend (const byte *ptr, const byte *end, const page_id_t &page_id, ulint parsed_bytes, bool parse_only) |
Redo a tablespace extend. More... | |
const byte * | fil_tablespace_redo_encryption (const byte *ptr, const byte *end, space_id_t space_id, lsn_t lsn) |
Parse and process an encryption redo record. More... | |
void | fil_tablespace_open_init_for_recovery (bool recovery) |
Read the tablespace id to path mapping from the file. More... | |
bool | fil_tablespace_lookup_for_recovery (space_id_t space_id) |
Lookup the tablespace ID. More... | |
bool | fil_update_partition_name (space_id_t space_id, uint32_t fsp_flags, bool update_space, std::string &space_name, std::string &dd_path) |
Compare and update space name and dd path for partitioned table. More... | |
void | fil_add_moved_space (dd::Object_id dd_object_id, space_id_t space_id, const char *space_name, const std::string &old_path, const std::string &new_path, bool before_90000) |
Add tablespace to the set of tablespaces to be updated in DD. More... | |
Fil_state | fil_tablespace_path_equals (space_id_t space_id, const char *space_name, ulint fsp_flags, std::string old_path, bool data_dir_flag_missing, std::string *new_path) |
Lookup the tablespace ID and return the path to the file. More... | |
bool | fil_check_missing_tablespaces () |
This function should be called after recovery has completed. More... | |
void | fil_set_scan_dir (const std::string &directory, bool is_undo_dir=false) |
Normalize and save a directory to scan for datafiles. More... | |
void | fil_set_scan_dirs (const std::string &directories) |
Normalize and save a list of directories to scan for datafiles. More... | |
dberr_t | fil_scan_for_tablespaces () |
Discover tablespaces by reading the header from .ibd files. More... | |
dberr_t | fil_tablespace_open_for_recovery (space_id_t space_id) |
Open the tablespace and also get the tablespace filenames, space_id must already be known. More... | |
bool | fil_op_replay_rename_for_ddl (const page_id_t &page_id, const char *old_name, const char *new_name) |
Replay a file rename operation for ddl replay. More... | |
dberr_t | fil_open_for_business (bool read_only_mode) |
Free the Tablespace_files instance. More... | |
bool | fil_path_is_known (const std::string &path) |
Check if a path is known to InnoDB meaning that it is in or under one of the four path settings scanned at startup for file discovery. More... | |
std::string | fil_get_dirs () |
Get the list of directories that datafiles can reside in. More... | |
dberr_t | fil_rename_tablespace_by_id (space_id_t space_id, const char *old_name, const char *new_name) |
Rename a tablespace. More... | |
dberr_t | fil_write_initial_pages (pfs_os_file_t file, const char *path, fil_type_t type, page_no_t size, const byte *encrypt_info, space_id_t space_id, uint32_t &space_flags, bool &punch_hole) |
Write initial pages for a new tablespace file created. More... | |
void | fil_free_scanned_files () |
Free the data structures required for recovery. More... | |
void | fil_space_update_name (fil_space_t *space, const char *name) |
Update the tablespace name. More... | |
void | fil_adjust_name_import (dict_table_t *table, const char *path, ib_file_suffix extn) |
Adjust file name for import for partition files in different letter case. More... | |
void | fil_purge () |
Allows fil system to do periodical cleanup. More... | |
size_t | fil_count_undo_deleted (space_id_t undo_num) |
Count how many truncated undo space IDs are still tracked in the buffer pool and the file_system cache. More... | |
const char * | fil_get_page_type_str (page_type_t type) noexcept |
Get the page type as a string. More... | |
bool | fil_is_page_type_valid (page_type_t type) noexcept |
Check if the given page type is valid. More... | |
dberr_t | fil_prepare_file_for_io (space_id_t space_id, page_no_t &page_no, fil_node_t **node_out) |
void | fil_complete_write (space_id_t space_id, fil_node_t *node) |
Variables | |
ulong | srv_fast_shutdown |
The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown. More... | |
constexpr size_t | FIL_SCAN_MAX_TABLESPACES_PER_THREAD = 8000 |
Maximum number of tablespaces to be scanned by a thread while scanning for available tablespaces during server startup. More... | |
constexpr size_t | FIL_SCAN_MAX_THREADS = 16 |
Maximum number of threads that will be used for scanning the tablespace files. More... | |
constexpr size_t | FIL_SCAN_THREADS_PER_CORE = 2 |
Number of threads per core. More... | |
static constexpr char | general_space_name [] = "innodb_general" |
This tablespace name is used internally during file discovery to open a general tablespace before the data dictionary is recovered and available. More... | |
static constexpr char | undo_space_name [] = "innodb_undo" |
This tablespace name is used as the prefix for implicit undo tablespaces and during file discovery to open an undo tablespace before the DD is recovered and available. More... | |
volatile bool | recv_recovery_on |
true when applying redo log records during crash recovery; false otherwise. More... | |
constexpr uint32_t | UNDO_INITIAL_SIZE = 16 * 1024 * 1024 |
Initial size of an UNDO tablespace when it is created new or truncated under low load. More... | |
constexpr size_t | FIL_SPACE_MAGIC_N = 89472 |
Value of fil_space_t::magic_n. More... | |
constexpr size_t | FIL_NODE_MAGIC_N = 89389 |
Value of fil_node_t::magic_n. More... | |
const char * | dot_ext [] |
Common InnoDB file extensions. More... | |
Fil_path | MySQL_datadir_path |
The MySQL server –datadir value. More... | |
Fil_path | MySQL_undo_path |
The MySQL server –innodb-undo-directory value. More... | |
bool | MySQL_undo_path_is_unique |
The undo path is different from any other known directory. More... | |
constexpr size_t | FIL_IBD_FILE_INITIAL_SIZE = 7 |
Initial size of a single-table tablespace in pages. More... | |
constexpr size_t | FIL_IBT_FILE_INITIAL_SIZE = 5 |
constexpr size_t | FIL_IBD_FILE_INITIAL_SIZE_5_7 = 4 |
An empty tablespace (CREATE TABLESPACE) has minimum of 4 pages and an empty CREATE TABLE (file_per_table) has 6 pages. More... | |
constexpr page_no_t | FIL_NULL = std::numeric_limits<page_no_t>::max() |
'null' (undefined) page offset in the context of file spaces More... | |
constexpr page_no_t | PAGE_NO_MAX = std::numeric_limits<page_no_t>::max() - 1 |
Maximum Page Number, one less than FIL_NULL. More... | |
constexpr space_id_t | SPACE_UNKNOWN = std::numeric_limits<space_id_t>::max() |
Unknown space id. More... | |
fil_addr_t | fil_addr_null |
The null file address. More... | |
std::atomic< std::uint64_t > | fil_n_pending_tablespace_flushes |
Number of pending tablespace flushes. More... | |
std::atomic_size_t | fil_n_files_open |
Number of files currently open. More... | |
constexpr page_type_t | FIL_PAGE_INDEX = 17855 |
File page types (values of FIL_PAGE_TYPE) More... | |
constexpr page_type_t | FIL_PAGE_RTREE = 17854 |
R-tree node. More... | |
constexpr page_type_t | FIL_PAGE_SDI = 17853 |
Tablespace SDI Index page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_UNUSED = 1 |
This page type is unused. More... | |
constexpr page_type_t | FIL_PAGE_UNDO_LOG = 2 |
Undo log page. More... | |
constexpr page_type_t | FIL_PAGE_INODE = 3 |
Index node. More... | |
constexpr page_type_t | FIL_PAGE_IBUF_FREE_LIST = 4 |
Insert buffer free list. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ALLOCATED = 0 |
Freshly allocated page. More... | |
constexpr page_type_t | FIL_PAGE_IBUF_BITMAP = 5 |
Insert buffer bitmap. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_SYS = 6 |
System page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_TRX_SYS = 7 |
Transaction system data. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_FSP_HDR = 8 |
File space header. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_XDES = 9 |
Extent descriptor page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_BLOB = 10 |
Uncompressed BLOB page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZBLOB = 11 |
First compressed BLOB page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZBLOB2 = 12 |
Subsequent compressed BLOB page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_UNKNOWN = 13 |
In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this value when flushing pages. More... | |
constexpr page_type_t | FIL_PAGE_COMPRESSED = 14 |
Compressed page. More... | |
constexpr page_type_t | FIL_PAGE_ENCRYPTED = 15 |
Encrypted page. More... | |
constexpr page_type_t | FIL_PAGE_COMPRESSED_AND_ENCRYPTED = 16 |
Compressed and Encrypted page. More... | |
constexpr page_type_t | FIL_PAGE_ENCRYPTED_RTREE = 17 |
Encrypted R-tree page. More... | |
constexpr page_type_t | FIL_PAGE_SDI_BLOB = 18 |
Uncompressed SDI BLOB page. More... | |
constexpr page_type_t | FIL_PAGE_SDI_ZBLOB = 19 |
Compressed SDI BLOB page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_LEGACY_DBLWR = 20 |
Legacy doublewrite buffer page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_RSEG_ARRAY = 21 |
Rollback Segment Array page. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_LOB_INDEX = 22 |
Index pages of uncompressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_LOB_DATA = 23 |
Data pages of uncompressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_LOB_FIRST = 24 |
The first page of an uncompressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZLOB_FIRST = 25 |
The first page of a compressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZLOB_DATA = 26 |
Data pages of compressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZLOB_INDEX = 27 |
Index pages of compressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZLOB_FRAG = 28 |
Fragment pages of compressed LOB. More... | |
constexpr page_type_t | FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY = 29 |
Index pages of fragment pages (compressed LOB). More... | |
constexpr page_type_t | FIL_PAGE_TYPE_LAST = FIL_PAGE_TYPE_ZLOB_FRAG_ENTRY |
Note the highest valid non-index page_type_t. More... | |
bool | fil_page_type_is_index (page_type_t page_type) |
Check whether the page type is index (Btree or Rtree or SDI) type. More... | |
page_type_t | fil_page_get_type (const byte *page) |
Get the file page type. More... | |
bool | fil_page_index_page_check (const byte *page) |
Check whether the page is index page (either regular Btree index or Rtree index. More... | |
The low-level file system.
Created 10/25/1995 Heikki Tuuri
#define fil_block_check_type | ( | block, | |
type, | |||
mtr | |||
) | fil_page_check_type(block->page.id, block->frame, type, mtr) |
Check (and if needed, reset) the page type.
Data files created before MySQL 5.1 may contain garbage in the FIL_PAGE_TYPE field. In MySQL 3.23.53, only undo log pages and index pages were tagged. Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
[in,out] | block | Block with possibly invalid FIL_PAGE_TYPE |
[in] | type | Expected page type |
[in,out] | mtr | Mini-transaction |
#define UNDO_INITIAL_SIZE_IN_PAGES os_offset_t { UNDO_INITIAL_SIZE / srv_page_size } |
using fil_faddr_t = byte |
'type' definition in C: an address stored in a file page is a string of bytes
using Filenames = std::vector<std::string, ut::allocator<std::string> > |
using page_type_t = uint16_t |
using Space_ids = std::vector<space_id_t, ut::allocator<space_id_t> > |
|
strong |
Result of comparing a path.
enum fil_type_t : uint8_t |
enum ib_file_suffix |
void fil_add_moved_space | ( | dd::Object_id | dd_object_id, |
space_id_t | space_id, | ||
const char * | space_name, | ||
const std::string & | old_path, | ||
const std::string & | new_path, | ||
bool | before_90000 | ||
) |
Add tablespace to the set of tablespaces to be updated in DD.
[in] | dd_object_id | Server DD tablespace ID |
[in] | space_id | Innodb tablespace ID |
[in] | space_name | New tablespace name |
[in] | old_path | Old Path in the data dictionary |
[in] | new_path | New path to be update in dictionary |
[in] | before_90000 | The move has happened before 90000 and did not update DD_TABLE_DATA_DIRECTORY flag. |
bool fil_addr_is_null | ( | const fil_addr_t & | addr | ) |
Returns true if file address is undefined.
[in] | addr | File address to check |
void fil_adjust_name_import | ( | dict_table_t * | table, |
const char * | path, | ||
ib_file_suffix | extn | ||
) |
Adjust file name for import for partition files in different letter case.
[in] | table | Innodb dict table |
[in] | path | file path to open |
[in] | extn | file extension |
void fil_aio_wait | ( | ulint | segment | ) |
Waits for an AIO operation to complete.
This function is used to write the handler for completed requests. The aio array of pending requests is divided into segments (see os0file.cc for more info). The thread specifies which segment it wants to wait for.
[in] | segment | The number of the segment in the AIO array to wait for |
bool fil_assign_new_space_id | ( | space_id_t * | space_id | ) |
Assigns a new space id for a new single-table tablespace.
This works simply by incrementing the global counter. If 4 billion id's is not enough, we may need to recycle id's.
[out] | space_id | Set this to the new tablespace ID |
bool fil_check_missing_tablespaces | ( | ) |
This function should be called after recovery has completed.
Check for tablespace files for which we did not see any MLOG_FILE_DELETE or MLOG_FILE_RENAME record. These could not be recovered
void fil_close | ( | ) |
Initializes the tablespace memory cache.
Initializes the tablespace memory cache.
void fil_close_all_files | ( | ) |
Closes all open files.
There must not be any pending i/o's or not flushed modifications in the files.
dberr_t fil_close_tablespace | ( | space_id_t | space_id | ) |
Closes a single-table tablespace.
The tablespace must be cached in the memory cache. Free all pages used by the tablespace.
[in] | space_id | Tablespace ID |
void fil_complete_write | ( | space_id_t | space_id, |
fil_node_t * | node | ||
) |
size_t fil_count_undo_deleted | ( | space_id_t | undo_num | ) |
Count how many truncated undo space IDs are still tracked in the buffer pool and the file_system cache.
[in] | undo_num | undo tablespace number. |
bool fil_delete_file | ( | const char * | path | ) |
Delete the tablespace file and any related files like .cfg.
This should not be called for temporary tables.
[in] | path | File path of the IBD tablespace |
dberr_t fil_delete_tablespace | ( | space_id_t | space_id, |
buf_remove_t | buf_remove | ||
) |
Deletes an IBD or IBU tablespace.
The tablespace must be cached in the memory cache. This will delete the datafile, fil_space_t & fil_node_t entries from the file_system_t cache.
[in] | space_id | Tablespace ID |
[in] | buf_remove | Specify the action to take on the pages for this table in the buffer pool. |
dberr_t fil_discard_tablespace | ( | space_id_t | space_id | ) |
Discards a single-table tablespace.
The tablespace must be cached in the memory cache. Discarding is like deleting a tablespace, but
[in] | space_id | Tablespace ID |
void fil_encryption_reencrypt | ( | std::vector< space_id_t > & | sid_vector | ) |
Roencrypt the tablespace keys by current master key.
size_t fil_encryption_rotate | ( | ) |
Rotate the tablespace keys by new master key.
void fil_extend_tablespaces_to_stored_len | ( | ) |
Extends all tablespaces to the size stored in the space header.
During the mysqlbackup –apply-log phase we extended the spaces on-demand so that log records could be appllied, but that may have left spaces still too small compared to the size stored in the space header.
void fil_flush | ( | space_id_t | space_id | ) |
Flushes to disk possible writes cached by the OS.
If the space does not exist or is being dropped, does not do anything.
[in] | space_id | Tablespace ID |
void fil_flush_file_spaces | ( | ) |
Flush to disk the writes in file spaces possibly cached by the OS (note: spaces of type FIL_TYPE_TEMPORARY are skipped)
void fil_free_scanned_files | ( | ) |
Free the data structures required for recovery.
Compression::Type fil_get_compression | ( | space_id_t | space_id | ) |
Get the compression algorithm for a tablespace.
[in] | space_id | Space ID to check |
std::string fil_get_dirs | ( | ) |
Get the list of directories that datafiles can reside in.
|
noexcept |
Get the page type as a string.
[in] | type | page type to be converted to string. |
size_t fil_get_scan_threads | ( | size_t | num_files | ) |
Calculate the number of threads that can be spawned to scan the given number of files taking into the consideration, number of cores available on the machine.
[in] | num_files | Number of files to be scanned |
dberr_t fil_ibd_create | ( | space_id_t | space_id, |
const char * | name, | ||
const char * | path, | ||
uint32_t | flags, | ||
page_no_t | size | ||
) |
Create an IBD tablespace file.
[in] | space_id | Tablespace ID |
[in] | name | Tablespace name in dbname/tablename format. For general tablespaces, the 'dbname/' part may be missing. |
[in] | path | Path and filename of the datafile to create. |
[in] | flags | Tablespace flags |
[in] | size | Initial size of the tablespace file in pages, must be >= FIL_IBD_FILE_INITIAL_SIZE |
dberr_t fil_ibd_open | ( | bool | validate, |
fil_type_t | purpose, | ||
space_id_t | space_id, | ||
uint32_t | flags, | ||
const char * | space_name, | ||
const char * | path_in, | ||
bool | strict, | ||
bool | old_space | ||
) |
Open a single-table tablespace and optionally do some validation such as checking that the space id is correct.
If the file is already open, the validation will be done before reporting success. If not successful, print an error message to the error log. This function is used to open a tablespace when we start up mysqld, and also in IMPORT TABLESPACE. NOTE that we assume this operation is used either at the database startup or under the protection of the dictionary mutex, so that two users cannot race here.
The fil_node_t::handle will not be left open.
[in] | validate | whether we should validate the tablespace (read the first page of the file and check that the space id in it matches id) |
[in] | purpose | FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY |
[in] | space_id | Tablespace ID |
[in] | flags | tablespace flags |
[in] | space_name | tablespace name of the datafile If file-per-table, it is the table name in the databasename/tablename format |
[in] | path_in | expected filepath, usually read from dictionary |
[in] | strict | whether to report error when open ibd failed |
[in] | old_space | whether it is a 5.7 tablespace opening by upgrade |
dberr_t fil_ibt_create | ( | space_id_t | space_id, |
const char * | name, | ||
const char * | path, | ||
uint32_t | flags, | ||
page_no_t | size | ||
) |
Create a session temporary tablespace (IBT) file.
[in] | space_id | Tablespace ID |
[in] | name | Tablespace name |
[in] | path | Path and filename of the datafile to create. |
[in] | flags | Tablespace flags |
[in] | size | Initial size of the tablespace file in pages, must be >= FIL_IBT_FILE_INITIAL_SIZE |
void fil_init | ( | ulint | max_n_open | ) |
Initializes the tablespace memory cache.
[in] | max_n_open | Maximum number of open files |
dberr_t fil_io | ( | const IORequest & | type, |
bool | sync, | ||
const page_id_t & | page_id, | ||
const page_size_t & | page_size, | ||
ulint | byte_offset, | ||
ulint | len, | ||
void * | buf, | ||
void * | message | ||
) |
Read or write data from a file.
[in] | type | IO context |
[in] | sync | If true then do synchronous IO |
[in] | page_id | page id |
[in] | page_size | page size |
[in] | byte_offset | remainder of offset in bytes; in aio this must be divisible by the OS block size |
[in] | len | how many bytes to read or write; this must not cross a file boundary; in AIO this must be a block size multiple |
[in,out] | buf | buffer where to store read data or from where to write; in AIO this must be appropriately aligned |
[in] | message | message for AIO handler if !sync, else ignored |
DB_SUCCESS | on success |
DB_TABLESPACE_DELETED | if the tablespace does not exist |
void fil_io_set_encryption | ( | IORequest & | req_type, |
const page_id_t & | page_id, | ||
fil_space_t * | space | ||
) |
Set encryption information for IORequest.
[in,out] | req_type | IO request |
[in] | page_id | page id |
[in] | space | table space |
|
noexcept |
Check if the given page type is valid.
[in] | type | the page type to be checked for validity. |
void fil_no_punch_hole | ( | fil_node_t * | file | ) |
Note that the file system where the file resides doesn't support PUNCH HOLE.
Called from AIO handlers when IO returns DB_IO_NO_PUNCH_HOLE
[in,out] | file | file to set |
char * fil_node_create | ( | const char * | name, |
page_no_t | size, | ||
fil_space_t * | space, | ||
bool | is_raw, | ||
page_no_t | max_pages | ||
) |
Attach a file to a tablespace.
File must be closed.
[in] | name | file name (file must be closed) |
[in] | size | file size in database blocks, rounded downwards to an integer |
[in,out] | space | space where to append |
[in] | is_raw | true if a raw device or a raw disk partition |
[in] | max_pages | maximum number of pages in file |
nullptr | if error |
bool fil_op_replay_rename_for_ddl | ( | const page_id_t & | page_id, |
const char * | old_name, | ||
const char * | new_name | ||
) |
Replay a file rename operation for ddl replay.
[in] | page_id | Space ID and first page number in the file |
[in] | old_name | old file name |
[in] | new_name | new file name |
bool fil_open_files_limit_update | ( | size_t & | new_max_open_files | ) |
Changes the maximum opened files limit.
[in,out] | new_max_open_files | New value for the open files limit. If the limit cannot be changed, the value is changed to a minimum value recommended. |
dberr_t fil_open_for_business | ( | bool | read_only_mode | ) |
Free the Tablespace_files instance.
[in] | read_only_mode | true if InnoDB is started in read only mode. |
void fil_open_system_tablespace_files | ( | ) |
Opens all log files and system tablespace data files.
They stay open until the database server shutdown. This should be called at a server startup after the space objects for the log and the system tablespace have been created. The purpose of this operation is to make sure we never run out of file descriptors if we need to read from the insert buffer or to write to the log.
Opens all log files and system tablespace data files.
They stay open until the database server shutdown. This should be called at a server startup after the space objects for the log and the system tablespace have been created. The purpose of this operation is to make sure we never run out of file descriptors if we need to read from the insert buffer or to write to the log.
Check (and if needed, reset) the page type.
Data files created before MySQL 5.1 may contain garbage in the FIL_PAGE_TYPE field. In MySQL 3.23.53, only undo log pages and index pages were tagged. Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
[in] | page_id | Page number |
[in,out] | page | Page with possibly invalid FIL_PAGE_TYPE |
[in] | type | Expected page type |
[in,out] | mtr | Mini-transaction |
Get the successor of a file page.
[in] | page | File page |
Get the predecessor of a file page.
[in] | page | File page |
|
inline |
Get the file page type.
[in] | page | File page |
|
inline |
Check whether the page is index page (either regular Btree index or Rtree index.
[in] | page | page frame whose page type is to be checked. |
Reset the page type.
Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE. In MySQL 3.23.53, only undo log pages and index pages were tagged. Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
[in] | page_id | Page number |
[in,out] | page | Page with invalid FIL_PAGE_TYPE |
[in] | type | Expected page type |
[in,out] | mtr | Mini-transaction |
Sets the file page type.
[in,out] | page | File page |
[in] | type | File page type to set |
|
inline |
Check whether the page type is index (Btree or Rtree or SDI) type.
bool fil_path_is_known | ( | const std::string & | path | ) |
Check if a path is known to InnoDB meaning that it is in or under one of the four path settings scanned at startup for file discovery.
[in] | path | Path to check |
char * fil_path_to_space_name | ( | const char * | filename | ) |
Convert a file name to a tablespace name.
Strip the file name prefix and suffix, leaving only databasename/tablename.
[in] | filename | directory/databasename/tablename.ibd |
dberr_t fil_prepare_file_for_io | ( | space_id_t | space_id, |
page_no_t & | page_no, | ||
fil_node_t ** | node_out | ||
) |
void fil_purge | ( | ) |
Allows fil system to do periodical cleanup.
dberr_t fil_rename_precheck | ( | const dict_table_t * | old_table, |
const dict_table_t * | new_table, | ||
const char * | tmp_name | ||
) |
Check if swapping two .ibd files can be done without failure.
[in] | old_table | old table |
[in] | new_table | new table |
[in] | tmp_name | temporary table name |
dberr_t fil_rename_tablespace | ( | space_id_t | space_id, |
const char * | old_path, | ||
const char * | new_name, | ||
const char * | new_path_in | ||
) |
Rename a single-table tablespace.
The tablespace must exist in the memory cache.
[in] | space_id | Tablespace ID |
[in] | old_path | Old file name |
[in] | new_name | New tablespace name in the schema/name format |
[in] | new_path_in | New file name, or nullptr if it is located in the normal data directory |
dberr_t fil_rename_tablespace_by_id | ( | space_id_t | space_id, |
const char * | old_name, | ||
const char * | new_name | ||
) |
Rename a tablespace.
Use the space_id to find the shard.
[in] | space_id | tablespace ID |
[in] | old_name | old tablespace name |
[in] | new_name | new tablespace name |
dberr_t fil_rename_tablespace_check | ( | space_id_t | space_id, |
const char * | old_path, | ||
const char * | new_path, | ||
bool | is_discarded | ||
) |
Test if a tablespace file can be renamed to a new filepath by checking if that the old filepath exists and the new filepath does not exist.
[in] | space_id | Tablespace ID |
[in] | old_path | Old filepath |
[in] | new_path | New filepath |
[in] | is_discarded | Whether the tablespace is discarded |
dberr_t fil_reset_encryption | ( | space_id_t | space_id | ) |
Reset the encryption type for the tablespace.
[in] | space_id | Space ID of tablespace for which to set |
dberr_t fil_scan_for_tablespaces | ( | ) |
Discover tablespaces by reading the header from .ibd files.
dberr_t fil_set_autoextend_size | ( | space_id_t | space_id, |
uint64_t | autoextend_size | ||
) |
Set the autoextend_size attribute for the tablespace.
[in] | space_id | Space ID of tablespace for which to set |
[in] | autoextend_size | Value of autoextend_size attribute |
dberr_t fil_set_compression | ( | space_id_t | space_id, |
const char * | algorithm | ||
) |
Set the compression type for the tablespace.
[in] | space_id | Space ID of the tablespace |
[in] | algorithm | Text representation of the algorithm |
dberr_t fil_set_encryption | ( | space_id_t | space_id, |
Encryption::Type | algorithm, | ||
byte * | key, | ||
byte * | iv | ||
) |
Set the encryption type for the tablespace.
[in] | space_id | Space ID of tablespace for which to set |
[in] | algorithm | Encryption algorithm |
[in] | key | Encryption key |
[in] | iv | Encryption iv |
void fil_set_max_space_id_if_bigger | ( | space_id_t | max_id | ) |
Sets the max tablespace id counter if the given number is bigger than the previous value.
[in] | max_id | Maximum known tablespace ID |
void fil_set_scan_dir | ( | const std::string & | directory, |
bool | is_undo_dir = false |
||
) |
Normalize and save a directory to scan for datafiles.
[in] | directory | directory to scan for ibd and ibu files |
[in] | is_undo_dir | true for an undo directory |
void fil_set_scan_dirs | ( | const std::string & | directories | ) |
Normalize and save a list of directories to scan for datafiles.
[in] | directories | Directories to scan for ibd and ibu files in the form: "dir1;dir2; ... dirN" |
fil_space_t * fil_space_acquire | ( | space_id_t | space_id | ) |
Acquire a tablespace when it could be dropped concurrently.
Used by background threads that do not necessarily hold proper locks for concurrency control.
[in] | space_id | Tablespace ID |
fil_space_t * fil_space_acquire_silent | ( | space_id_t | space_id | ) |
Acquire a tablespace that may not exist.
Used by background threads that do not necessarily hold proper locks for concurrency control.
[in] | space_id | Tablespace ID |
void fil_space_close | ( | space_id_t | space_id | ) |
Close each file of a tablespace if open.
[in] | space_id | Tablespace ID |
fil_space_t * fil_space_create | ( | const char * | name, |
space_id_t | space_id, | ||
uint32_t | flags, | ||
fil_type_t | purpose | ||
) |
Create a space memory object and put it to the fil_system hash table.
The tablespace name is independent from the tablespace file-name. Error messages are issued to the server log.
[in] | name | Tablespace name |
[in] | space_id | Tablespace ID |
[in] | flags | Tablespace flags |
[in] | purpose | Tablespace purpose |
nullptr | on failure (such as when the same tablespace exists) |
void fil_space_dec_redo_skipped_count | ( | space_id_t | space_id | ) |
Decrease redo skipped count for a tablespace.
[in] | space_id | Tablespace ID |
bool fil_space_exists_in_mem | ( | space_id_t | space_id, |
const char * | name, | ||
bool | print_err, | ||
bool | adjust_space | ||
) |
Returns true if a matching tablespace exists in the InnoDB tablespace memory cache.
[in] | space_id | Tablespace ID |
[in] | name | Tablespace name used in space_create(). |
[in] | print_err | Print detailed error information to the error log if a matching tablespace is not found from memory. |
[in] | adjust_space | Whether to adjust space id on mismatch |
bool fil_space_extend | ( | fil_space_t * | space, |
page_no_t | size | ||
) |
Try to extend a tablespace if it is smaller than the specified size.
[in,out] | space | Tablespace ID |
[in] | size | desired size in pages |
fil_space_t * fil_space_get | ( | space_id_t | space_id | ) |
Look up a tablespace.
The caller should hold an InnoDB table lock or a MDL that prevents the tablespace from being dropped during the operation, or the caller should be in single-threaded crash recovery mode (no user connections that could drop tablespaces). If this is not the case, fil_space_acquire() and fil_space_release() should be used instead.
[in] | space_id | Tablespace ID |
char * fil_space_get_first_path | ( | space_id_t | space_id | ) |
Returns the path from the first fil_node_t found with this space ID.
The caller is responsible for freeing the memory allocated here for the value returned.
[in] | space_id | Tablespace ID |
uint32_t fil_space_get_flags | ( | space_id_t | space_id | ) |
Returns the flags of the space.
The tablespace must be cached in the memory cache.
[in] | space_id | Tablespace ID for which to get the flags |
space_id_t fil_space_get_id_by_name | ( | const char * | name | ) |
Returns the space ID based on the tablespace name.
The tablespace must be found in the tablespace memory cache. This call is made from external to this module, so the mutex is not owned.
[in] | name | Tablespace name |
rw_lock_t * fil_space_get_latch | ( | space_id_t | space_id | ) |
Returns the latch of a file space.
[in] | space_id | Tablespace ID |
ulint fil_space_get_n_reserved_extents | ( | space_id_t | space_id | ) |
Gets the number of reserved extents.
If the database is silent, this number should be zero.
[in] | space_id | Tablespace ID |
const page_size_t fil_space_get_page_size | ( | space_id_t | space_id, |
bool * | found | ||
) |
Returns the page size of the space and whether it is compressed or not.
The tablespace must be cached in the memory cache.
[in] | space_id | Tablespace ID |
[out] | found | true if tablespace was found |
page_no_t fil_space_get_size | ( | space_id_t | space_id | ) |
Returns the size of the space in pages.
The tablespace must be cached in the memory cache.
[in] | space_id | Tablespace ID |
|
inline |
fil_type_t fil_space_get_type | ( | space_id_t | space_id | ) |
Gets the type of a file space.
[in] | space_id | Tablespace ID |
page_no_t fil_space_get_undo_initial_size | ( | space_id_t | space_id | ) |
Returns the size of an undo space just after it was initialized.
[in] | space_id | Tablespace ID |
void fil_space_inc_redo_skipped_count | ( | space_id_t | space_id | ) |
Increase redo skipped count for a tablespace.
[in] | space_id | Tablespace ID |
bool fil_space_is_redo_skipped | ( | space_id_t | space_id | ) |
Check whether a single-table tablespace is redo skipped.
[in] | space_id | Tablespace ID |
bool fil_space_open | ( | space_id_t | space_id | ) |
Open each file of a tablespace if not already open.
[in] | space_id | Tablespace ID |
true | if all file nodes were opened |
false | on failure |
|
inline |
During crash recovery, open a tablespace if it had not been opened yet, to get valid size and flags.
[in,out] | space | Tablespace instance |
bool fil_space_read_name_and_filepath | ( | space_id_t | space_id, |
char ** | name, | ||
char ** | filepath | ||
) |
Looks for a pre-existing fil_space_t with the given tablespace ID and, if found, returns the name and filepath in newly allocated buffers that the caller must free.
[in] | space_id | The tablespace ID to search for. |
[out] | name | Name of the tablespace found. |
[out] | filepath | The filepath of the first datafile for the tablespace. |
void fil_space_release | ( | fil_space_t * | space | ) |
Release a tablespace acquired with fil_space_acquire().
[in,out] | space | Tablespace to release |
void fil_space_release_free_extents | ( | space_id_t | space_id, |
ulint | n_reserved | ||
) |
Releases free extents in a file space.
[in] | space_id | Tablespace ID |
[in] | n_reserved | How many were reserved |
bool fil_space_reserve_free_extents | ( | space_id_t | space_id, |
ulint | n_free_now, | ||
ulint | n_to_reserve | ||
) |
Tries to reserve free extents in a file space.
[in] | space_id | Tablespace ID |
[in] | n_free_now | Number of free extents now |
[in] | n_to_reserve | How many one wants to reserve |
void fil_space_set_flags | ( | fil_space_t * | space, |
uint32_t | flags | ||
) |
Sets the flags of the tablespace.
The tablespace must be locked in MDL_EXCLUSIVE MODE.
[in] | space | tablespace in-memory struct |
[in] | flags | tablespace flags |
void fil_space_set_imported | ( | space_id_t | space_id | ) |
Note that a tablespace has been imported.
It is initially marked as FIL_TYPE_IMPORT so that no logging is done during the import process when the space ID is stamped to each page. Now we change it to FIL_TYPE_TABLESPACE to start redo and undo logging. NOTE: temporary tablespaces are never imported.
[in] | space_id | Tablespace ID |
void fil_space_set_undo_size | ( | space_id_t | space_id, |
bool | use_current | ||
) |
This is called for an undo tablespace after it has been initialized or opened.
It sets the minimum size in pages at which it should be truncated and the number of pages that it should be extended. An undo tablespace is extended by larger amounts than normal tablespaces. It starts at 16Mb and is increased during aggressive growth and decreased when the growth is slower.
[in] | space_id | Tablespace ID |
[in] | use_current | If true, use the current size in pages as the initial size. If false, use UNDO_INITIAL_SIZE_IN_PAGES. |
void fil_space_update_name | ( | fil_space_t * | space, |
const char * | name | ||
) |
Update the tablespace name.
In case, the new name and old name are same, no update done.
[in,out] | space | tablespace object on which name will be updated |
[in] | name | new name for tablespace |
bool fil_system_get_file_by_space_id | ( | space_id_t | space_id, |
std::string & | name | ||
) |
Fetch the file name opened for a space_id from the file map.
[in] | space_id | tablespace ID |
[out] | name | the scanned filename |
bool fil_system_get_file_by_space_num | ( | space_id_t | space_num, |
space_id_t & | space_id, | ||
std::string & | name | ||
) |
Fetch the file name opened for an undo space number from the file map.
[in] | space_num | Undo tablespace Number |
[out] | space_id | Undo tablespace ID |
[out] | name | the scanned filename |
dberr_t fil_tablespace_iterate | ( | const Encryption_metadata & | encryption_metadata, |
dict_table_t * | table, | ||
ulint | n_io_buffers, | ||
Compression::Type | compression_type, | ||
PageCallback & | callback | ||
) |
Iterate over all the pages in the tablespace.
[in] | encryption_metadata | the encryption metadata to use for reading |
[in] | table | the table definition in the server |
[in] | n_io_buffers | number of blocks to read and write together |
[in] | compression_type | compression type if compression is enabled, else Compression::Type::NONE |
[in,out] | callback | functor that will do the page updates |
Add an extra page for compressed page scratch area.
bool fil_tablespace_lookup_for_recovery | ( | space_id_t | space_id | ) |
Lookup the tablespace ID.
[in] | space_id | Tablespace ID to lookup |
dberr_t fil_tablespace_open_for_recovery | ( | space_id_t | space_id | ) |
Open the tablespace and also get the tablespace filenames, space_id must already be known.
[in] | space_id | Tablespace ID to lookup |
void fil_tablespace_open_init_for_recovery | ( | bool | recovery | ) |
Read the tablespace id to path mapping from the file.
[in] | recovery | true if called from crash recovery |
Fil_state fil_tablespace_path_equals | ( | space_id_t | space_id, |
const char * | space_name, | ||
ulint | fsp_flags, | ||
std::string | old_path, | ||
bool | data_dir_flag_missing, | ||
std::string * | new_path | ||
) |
Lookup the tablespace ID and return the path to the file.
The filename is ignored when testing for equality. Only the path up to the file name is considered for matching: e.g. ./test/a.ibd == ./test/b.ibd.
[in] | space_id | tablespace ID to lookup |
[in] | space_name | tablespace name |
[in] | fsp_flags | tablespace flags |
[in] | old_path | the path found in dd:Tablespace_files |
[in] | data_dir_flag_missing | true dd::Table exists, but DD_TABLE_DATA_DIRECTORY flag is not set |
[out] | new_path | the scanned path for this space_id |
const byte * fil_tablespace_redo_create | ( | const byte * | ptr, |
const byte * | end, | ||
const page_id_t & | page_id, | ||
ulint | parsed_bytes, | ||
bool | parse_only | ||
) |
Redo a tablespace create.
[in] | ptr | redo log record |
[in] | end | end of the redo log buffer |
[in] | page_id | Tablespace Id and first page in file |
[in] | parsed_bytes | Number of bytes parsed so far |
[in] | parse_only | Don't apply, parse only |
nullptr | if this log record was truncated |
const byte * fil_tablespace_redo_delete | ( | const byte * | ptr, |
const byte * | end, | ||
const page_id_t & | page_id, | ||
ulint | parsed_bytes, | ||
bool | parse_only | ||
) |
Redo a tablespace delete.
[in] | ptr | redo log record |
[in] | end | end of the redo log buffer |
[in] | page_id | Tablespace Id and first page in file |
[in] | parsed_bytes | Number of bytes parsed so far |
[in] | parse_only | Don't apply, parse only |
nullptr | if this log record was truncated |
const byte * fil_tablespace_redo_encryption | ( | const byte * | ptr, |
const byte * | end, | ||
space_id_t | space_id, | ||
lsn_t | lsn | ||
) |
Parse and process an encryption redo record.
[in] | ptr | redo log record |
[in] | end | end of the redo log buffer |
[in] | space_id | the tablespace ID |
[in] | lsn | lsn for REDO record |
const byte * fil_tablespace_redo_extend | ( | const byte * | ptr, |
const byte * | end, | ||
const page_id_t & | page_id, | ||
ulint | parsed_bytes, | ||
bool | parse_only | ||
) |
Redo a tablespace extend.
[in] | ptr | redo log record |
[in] | end | end of the redo log buffer |
[in] | page_id | Tablespace Id and first page in file |
[in] | parsed_bytes | Number of bytes parsed so far |
[in] | parse_only | Don't apply the log if true |
nullptr | if this log record was truncated |
const byte * fil_tablespace_redo_rename | ( | const byte * | ptr, |
const byte * | end, | ||
const page_id_t & | page_id, | ||
ulint | parsed_bytes, | ||
bool | parse_only | ||
) |
Redo a tablespace rename.
This function doesn't do anything, simply parses the redo log record.
[in] | ptr | redo log record |
[in] | end | end of the redo log buffer |
[in] | page_id | Tablespace Id and first page in file |
[in] | parsed_bytes | Number of bytes parsed so far |
[in] | parse_only | Don't apply, parse only |
nullptr | if this log record was truncated |
bool fil_truncate_tablespace | ( | space_id_t | space_id, |
page_no_t | size_in_pages | ||
) |
Truncate the tablespace to needed size.
[in] | space_id | Tablespace ID to truncate |
[in] | size_in_pages | Truncate size. |
bool fil_update_partition_name | ( | space_id_t | space_id, |
uint32_t | fsp_flags, | ||
bool | update_space, | ||
std::string & | space_name, | ||
std::string & | dd_path | ||
) |
Compare and update space name and dd path for partitioned table.
Uniformly converts partition separators and names to lower case.
[in] | space_id | tablespace ID |
[in] | fsp_flags | tablespace flags |
[in] | update_space | update space name |
[in,out] | space_name | tablespace name |
[in,out] | dd_path | file name with complete path |
bool fil_validate | ( | ) |
Checks the consistency of the tablespace cache.
Write the flushed LSN to the page header of the first page in the system tablespace.
[in] | lsn | Flushed LSN |
dberr_t fil_write_initial_pages | ( | pfs_os_file_t | file, |
const char * | path, | ||
fil_type_t | type, | ||
page_no_t | size, | ||
const byte * | encrypt_info, | ||
space_id_t | space_id, | ||
uint32_t & | space_flags, | ||
bool & | punch_hole | ||
) |
Write initial pages for a new tablespace file created.
[in] | file | open file handle |
[in] | path | path and filename of the datafile |
[in] | type | file type |
[in] | size | Initial size of the tablespace file in pages |
[in] | encrypt_info | encryption key information |
[in] | space_id | tablespace ID |
[in,out] | space_flags | tablespace flags |
[out] | punch_hole | if punch hole is used |
|
inline |
|
extern |
Common InnoDB file extensions.
|
extern |
The null file address.
|
constexpr |
Initial size of a single-table tablespace in pages.
|
constexpr |
An empty tablespace (CREATE TABLESPACE) has minimum of 4 pages and an empty CREATE TABLE (file_per_table) has 6 pages.
Minimum of these two is 4
|
constexpr |
|
extern |
Number of files currently open.
|
extern |
Number of pending tablespace flushes.
|
constexpr |
Value of fil_node_t::magic_n.
'null' (undefined) page offset in the context of file spaces
|
constexpr |
Compressed page.
|
constexpr |
Compressed and Encrypted page.
|
constexpr |
Encrypted page.
|
constexpr |
Encrypted R-tree page.
|
constexpr |
Insert buffer bitmap.
|
constexpr |
Insert buffer free list.
|
constexpr |
File page types (values of FIL_PAGE_TYPE)
B-tree node
|
constexpr |
Index node.
|
constexpr |
R-tree node.
|
constexpr |
Tablespace SDI Index page.
|
constexpr |
Uncompressed SDI BLOB page.
|
constexpr |
Compressed SDI BLOB page.
|
constexpr |
Freshly allocated page.
|
constexpr |
Uncompressed BLOB page.
|
constexpr |
File space header.
|
constexpr |
Note the highest valid non-index page_type_t.
|
constexpr |
Legacy doublewrite buffer page.
|
constexpr |
Data pages of uncompressed LOB.
|
constexpr |
The first page of an uncompressed LOB.
|
constexpr |
Index pages of uncompressed LOB.
|
constexpr |
Rollback Segment Array page.
|
constexpr |
System page.
|
constexpr |
Transaction system data.
|
constexpr |
In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this value when flushing pages.
|
constexpr |
This page type is unused.
|
constexpr |
Extent descriptor page.
|
constexpr |
First compressed BLOB page.
|
constexpr |
Subsequent compressed BLOB page.
|
constexpr |
Data pages of compressed LOB.
|
constexpr |
The first page of a compressed LOB.
|
constexpr |
Fragment pages of compressed LOB.
|
constexpr |
Index pages of fragment pages (compressed LOB).
|
constexpr |
Index pages of compressed LOB.
This page contains an array of z_index_entry_t objects.
|
constexpr |
Undo log page.
|
constexpr |
Maximum number of tablespaces to be scanned by a thread while scanning for available tablespaces during server startup.
This is a hard maximum. If the number of files to be scanned is more than FIL_SCAN_MAX_TABLESPACES_PER_THREAD, then additional threads will be spawned to scan the additional files in parallel.
|
constexpr |
Maximum number of threads that will be used for scanning the tablespace files.
This can be further adjusted depending on the number of available cores.
|
constexpr |
Number of threads per core.
|
constexpr |
Value of fil_space_t::magic_n.
|
staticconstexpr |
This tablespace name is used internally during file discovery to open a general tablespace before the data dictionary is recovered and available.
|
extern |
The MySQL server –datadir value.
The MySQL server –datadir value.
|
extern |
The MySQL server –innodb-undo-directory value.
The MySQL server –innodb-undo-directory value.
|
extern |
The undo path is different from any other known directory.
Maximum Page Number, one less than FIL_NULL.
|
extern |
true when applying redo log records during crash recovery; false otherwise.
Note that this is false while a background thread is rolling back incomplete transactions.
|
constexpr |
Unknown space id.
|
extern |
The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown.
If innodb_fast_shutdown=0, InnoDB shutdown will purge all undo log records (except XA PREPARE transactions) and complete the merge of the entire change buffer, and then shut down the redo log.
If innodb_fast_shutdown=1, InnoDB shutdown will only flush the buffer pool to data files, cleanly shutting down the redo log.
If innodb_fast_shutdown=2, shutdown will effectively 'crash' InnoDB (but lose no committed transactions).
|
constexpr |
Initial size of an UNDO tablespace when it is created new or truncated under low load.
page size | FSP_EXTENT_SIZE | Initial Size | Pages -------—+---------------—+-----------—+----— 4 KB | 256 pages = 1 MB | 16 MB | 4096 8 KB | 128 pages = 1 MB | 16 MB | 2048 16 KB | 64 pages = 1 MB | 16 MB | 1024 32 KB | 64 pages = 2 MB | 16 MB | 512 64 KB | 64 pages = 4 MB | 16 MB | 256
|
staticconstexpr |
This tablespace name is used as the prefix for implicit undo tablespaces and during file discovery to open an undo tablespace before the DD is recovered and available.