![]() |
MySQL 26.7.0
Source Code Documentation
|
Data file control information. More...
#include <fsp0file.h>
Classes | |
| struct | first_page_fields_cache_t |
| Cache of fields extracted from the first page. More... | |
Public Member Functions | |
| Datafile () | |
| Datafile (const Datafile &file)=delete | |
| ~Datafile () | |
| Datafile & | operator= (const Datafile &file)=delete |
| void | shutdown () |
| Release the resources. More... | |
| dberr_t | open_read_only () |
| Open a data file in read-only mode to check if it exists so that it can be validated. More... | |
| dberr_t | close () |
| Close a data file. More... | |
| void | extract_fields_from_first_page (const byte *page) |
| Extracts basic space fields from the first page header. More... | |
| bool | is_raw_type () |
| Returns if the Datafile is created in raw partition. More... | |
| void | make_filepath (const char *dirpath, const char *filename, ib_file_suffix ext) |
| Make a full filepath from a directory path and a filename. More... | |
| void | set_filepath (const char *filepath) |
| Set the filepath by duplicating the filepath sent in. More... | |
| dberr_t | validate_to_dd (const byte *page, space_id_t space_id, uint32_t flags, const std::string &filepath, bool for_import) |
| Validates the first page of tablespace supplied and checks that it conforms with the expected space ID and flags. More... | |
| dberr_t | validate_for_recovery (space_id_t space_id, uint32_t expected_physical_page_size) |
| Validates this datafile for the purpose of recovery. More... | |
| void | reset_first_page_fields_cache () |
| const char * | filepath () const |
| Get Datafile::m_filepath. More... | |
| pfs_os_file_t | handle () const |
| Get Datafile::m_handle. More... | |
| uint32_t | get_cached_server_version () const |
| Returns cached server version read from the first page during validation. More... | |
| uint32_t | get_cached_space_version () const |
| Returns cached space version read from the first page during validation. More... | |
| space_id_t | get_cached_space_id () const |
| Returns cached space ID read from the first page during validation. More... | |
| uint32_t | get_cached_space_flags () const |
| Returns cached space FSP flags read from the first page during validation. More... | |
| uint32_t | get_cached_space_flush_lsn () const |
| Returns cached space flush LSN read from the first page during validation. More... | |
| size_t | physical_page_size () const |
| Get the physical page size used by the tablespace. More... | |
| bool | is_open () const |
| bool | is_valid () const |
| Get Datafile::m_is_valid. More... | |
| page_no_t | size () const |
Public Attributes | |
| byte * | m_encryption_key {} |
| Encryption key read from first page. More... | |
| byte * | m_encryption_iv {} |
| Encryption iv read from first page. More... | |
| Encryption::Progress | m_encryption_op_in_progress {Encryption::Progress::NONE} |
| Encryption operation in progress. More... | |
| uint32_t | m_encryption_master_key_id {} |
| Master key id read from first page. More... | |
Protected Attributes | |
| char * | m_filepath {} |
| Physical file path with base name and extension. More... | |
Private Member Functions | |
| dberr_t | validate_first_page (const byte *page, space_id_t space_id, const std::string &filepath, bool for_import) |
Checks the consistency of the first page supplied when the tablespace is opened, and verifies the space is not already added to the fil mappings with a different datafile path. More... | |
| void | free_filepath () |
| Free the filepath buffer. More... | |
| void | set_filename () |
| Set the filename pointer to the start of the file name in the filepath. More... | |
| ut::Expected< ut::unique_ptr_aligned< byte[]> > | read_first_page (space_id_t space_id, uint32_t physical_page_size) |
| Reads the first page of the datafile. More... | |
Private Attributes | |
| char * | m_filename {} |
| Points into m_filepath to the file name with extension. More... | |
| pfs_os_file_t | m_handle |
| Open file handle. More... | |
| page_no_t | m_size {} |
| size in pages More... | |
| node_device_type_t | m_type {node_device_type_t::REGULAR_FILE} |
| The type of the data file. More... | |
| first_page_fields_cache_t | m_first_page_fields_cache |
| Cache of fields extracted from the first page. More... | |
| bool | m_exists {} |
| true if file already existed on startup More... | |
| bool | m_is_valid {} |
Friends | |
| class | SysTablespace |
Data file control information.
|
inline |
|
delete |
|
inline |
| dberr_t Datafile::close | ( | void | ) |
Close a data file.
| void Datafile::extract_fields_from_first_page | ( | const byte * | page | ) |
Extracts basic space fields from the first page header.
| [in] | page | The content of the first page of the tablespace. |
|
inline |
Get Datafile::m_filepath.
|
private |
Free the filepath buffer.
|
inline |
Returns cached server version read from the first page during validation.
|
inline |
Returns cached space FSP flags read from the first page during validation.
|
inline |
Returns cached space flush LSN read from the first page during validation.
|
inline |
Returns cached space ID read from the first page during validation.
|
inline |
Returns cached space version read from the first page during validation.
|
inline |
Get Datafile::m_handle.
|
inline |
|
inline |
Returns if the Datafile is created in raw partition.
|
inline |
Get Datafile::m_is_valid.
| void Datafile::make_filepath | ( | const char * | dirpath, |
| const char * | filename, | ||
| ib_file_suffix | ext | ||
| ) |
Make a full filepath from a directory path and a filename.
Prepend the dirpath to filename using the extension given. If dirpath is nullptr, prepend the default datadir to filepath. Store the result in m_filepath.
| [in] | dirpath | directory path |
| [in] | filename | filename or filepath |
| [in] | ext | filename extension |
| dberr_t Datafile::open_read_only | ( | ) |
Open a data file in read-only mode to check if it exists so that it can be validated.
|
inline |
Get the physical page size used by the tablespace.
|
private |
Reads the first page of the datafile.
The datafile must be already opened.
| [in] | space_id | Expected space ID |
| [in] | physical_page_size | Physical page size of the tablespace. |
|
inline |
|
inlineprivate |
Set the filename pointer to the start of the file name in the filepath.
| void Datafile::set_filepath | ( | const char * | filepath | ) |
Set the filepath by duplicating the filepath sent in.
This is the name of the file with its extension and absolute or relative path.
| [in] | filepath | filepath to set |
| void Datafile::shutdown | ( | ) |
Release the resources.
|
inline |
|
private |
Checks the consistency of the first page supplied when the tablespace is opened, and verifies the space is not already added to the fil mappings with a different datafile path.
m_is_valid is set true on success, else false. The datafile will not be attempted to be opened.
| [in] | page | The content of the first page of the tablespace. |
| [in] | space_id | Expected space ID |
| [in] | filepath | The file path to the first node in the tablespace, used for error message printing. |
| [in] | for_import | if it is for importing |
| DB_WRONG_FILE_NAME | tablespace in file header doesn't match expected value |
| DB_SUCCESS | on if the datafile is valid |
| DB_CORRUPTION | if the datafile is not readable |
| DB_INVALID_ENCRYPTION_META | if the encryption meta data is not readable |
| DB_TABLESPACE_EXISTS | if there is a duplicate space_id |
| dberr_t Datafile::validate_for_recovery | ( | space_id_t | space_id, |
| uint32_t | expected_physical_page_size | ||
| ) |
Validates this datafile for the purpose of recovery.
The file must exist and be already opened. The datafile is always closed when returning from this method.
| [in] | space_id | Expected space ID |
| [in] | expected_physical_page_size | Physical page size of the tablespace. |
| DB_WRONG_FILE_NAME | tablespace in file header doesn't match expected value |
| DB_SUCCESS | on if the datafile is valid |
| DB_CORRUPTION | if the datafile is not readable |
| DB_INVALID_ENCRYPTION_META | if the encryption meta data is not readable |
| DB_TABLESPACE_EXISTS | if there is a duplicate space_id m_is_valid is also set true on success, else false. |
| dberr_t Datafile::validate_to_dd | ( | const byte * | page, |
| space_id_t | space_id, | ||
| uint32_t | flags, | ||
| const std::string & | filepath, | ||
| bool | for_import | ||
| ) |
Validates the first page of tablespace supplied and checks that it conforms with the expected space ID and flags.
The datafile will not be attempted to be opened.
| [in] | page | The content of the first page of the tablespace. |
| [in] | space_id | The expected tablespace ID. |
| [in] | flags | The expected tablespace flags. |
| [in] | filepath | The file path to the first node in the tablespace, used for error message printing. |
| [in] | for_import | if it is for importing |
| DB_SUCCESS | if tablespace is valid, DB_ERROR if not. m_is_valid is also set true on success, else false. |
|
friend |
| byte* Datafile::m_encryption_iv {} |
Encryption iv read from first page.
| byte* Datafile::m_encryption_key {} |
Encryption key read from first page.
| uint32_t Datafile::m_encryption_master_key_id {} |
Master key id read from first page.
| Encryption::Progress Datafile::m_encryption_op_in_progress {Encryption::Progress::NONE} |
Encryption operation in progress.
|
private |
true if file already existed on startup
|
private |
Points into m_filepath to the file name with extension.
|
protected |
Physical file path with base name and extension.
|
private |
Cache of fields extracted from the first page.
|
private |
Open file handle.
|
private |
|
private |
size in pages
|
private |
The type of the data file.