MySQL 26.7.0
Source Code Documentation
ib::fsp::SysTablespace Class Reference

Data structure that contains the information about shared tablespaces. More...

#include <fsp0sysspace.h>

Inheritance diagram for ib::fsp::SysTablespace:
[legend]

Classes

class  Opened_storage_node
 

Public Member Functions

 SysTablespace (space_id_t space_id, fil_type_t space_type)
 
void set_tablespace_full_status (bool is_full)
 Set tablespace full status. More...
 
bool get_tablespace_full_status ()
 Get tablespace full status. More...
 
bool parse_params (const char *filepath_spec)
 Parse the input params and populate member variables. More...
 
dberr_t check_file_spec (bool create_new_tablespace, uint64_t min_expected_size, bool supports_raw_devices)
 Check the data file specification. More...
 
ulint can_auto_extend_last_file () const
 
dberr_t prepare_nodes ()
 Open or create the data files, register the tablespace and its nodes in the fil's tablespace registry. More...
 
ut::Expected< lsn_tread_lsn_and_check_flags ()
 Check the tablespace header for this tablespace and read the flush LSN. More...
 
page_no_t get_sum_of_new_sizes_in_pages () const
 
- Public Member Functions inherited from ib::fsp::Tablespace< SysTablespace_node >
 Tablespace (space_id_t space_id, fil_type_t space_type)
 
 Tablespace (const Tablespace &)=delete
 
virtual ~Tablespace ()
 
Tablespaceoperator= (const Tablespace &)=delete
 
const SysTablespace_nodenode (size_t order) const
 
fil_type_t space_type () const
 Get tablespace type. More...
 
void set_name (const char *name)
 Set tablespace name. More...
 
const char * name () const
 Get tablespace name. More...
 
void set_path (const std::string &path)
 Set tablespace path. More...
 
const std::string & path () const
 Get tablespace path. More...
 
void set_space_id (space_id_t space_id)
 Set the space id of the tablespace. More...
 
space_id_t space_id () const
 Get the space id of the tablespace. More...
 
void set_flags (uint32_t fsp_flags)
 Set the tablespace flags. More...
 
uint32_t flags () const
 Get the tablespace flags. More...
 
page_no_t get_sum_of_expected_sizes_in_pages () const
 
std::vector< size_t > delete_files ()
 Delete all the data files. More...
 
bool intersects (const Tablespace &other_space)
 Check if two tablespaces have common data file names. More...
 
void add_datafile (const char *node_path)
 Use the ADD DATAFILE path to create a node object and add it to the front of m_nodes. More...
 
bool is_read_only () const
 Determines if the current tablespace should be opened for read-only. More...
 
size_t get_nodes_count () const
 Returns the number of nodes the tablespace contains. More...
 
std::string get_node_full_path (size_t node_order=0) const
 Returns a full path to the node. More...
 
std::string get_node_full_path (const Tablespace_node &node) const
 Returns a full path to the node. More...
 
void set_autoextend_size (uint64_t size)
 
uint64_t get_autoextend_size () const
 

Static Public Member Functions

static page_no_t get_autoextend_increment ()
 

Private Types

enum class  file_status_t_ { FILE_STATUS_VOID = 0 , FILE_STATUS_RW_PERMISSION_ERROR , FILE_STATUS_READ_WRITE_ERROR , FILE_STATUS_NOT_REGULAR_FILE_ERROR }
 

Private Member Functions

ut::Expected< SysTablespace::Opened_storage_nodecreate_node (SysTablespace_node &node)
 Create storage for the specified data node. More...
 
ut::Expected< SysTablespace::Opened_storage_nodeopen_node (const SysTablespace_node &node)
 Open storage of the specified data node. More...
 
page_no_t parse_suffixed_page_count (char *&ptr)
 Convert a numeric string representing a number of bytes optionally ending in upper or lower case G, M, or K, to a number of megabytes, rounding down to the nearest megabyte. More...
 
dberr_t check_size (SysTablespace_node &node, const ib::fil::Tablespaces_nodes_interface::Node_info &node_info)
 Verify the size of the node storage. More...
 

Static Private Member Functions

static char * parse_file_name (char *ptr)
 

Private Attributes

bool m_auto_extend_last_file {}
 if true, then we auto-extend the last data file More...
 
page_no_t m_last_file_size_in_pages_max {}
 if != 0, this tells the max size auto-extending may increase the last data file size More...
 
bool m_is_tablespace_full {}
 Tablespace full status. More...
 
page_no_t m_sum_of_new_sizes_in_pages {}
 Sum of sizes of all nodes, in pages, that had the storage created during this instance lifetime. More...
 

Additional Inherited Members

- Protected Attributes inherited from ib::fsp::Tablespace< SysTablespace_node >
ut::vector< SysTablespace_nodem_nodes
 Data nodes information used in this tablespace, in the correct order. More...
 

Detailed Description

Data structure that contains the information about shared tablespaces.

Currently this can be the system tablespace or a temporary table tablespace

Member Enumeration Documentation

◆ file_status_t_

enum class ib::fsp::SysTablespace::file_status_t_
strongprivate
Enumerator
FILE_STATUS_VOID 
FILE_STATUS_RW_PERMISSION_ERROR 

status not set

FILE_STATUS_READ_WRITE_ERROR 

permission error

FILE_STATUS_NOT_REGULAR_FILE_ERROR 

not readable/writable

not a regular file

Constructor & Destructor Documentation

◆ SysTablespace()

ib::fsp::SysTablespace::SysTablespace ( space_id_t  space_id,
fil_type_t  space_type 
)
inline

Member Function Documentation

◆ can_auto_extend_last_file()

ulint ib::fsp::SysTablespace::can_auto_extend_last_file ( ) const
inline
Returns
auto_extend value setting

◆ check_file_spec()

dberr_t ib::fsp::SysTablespace::check_file_spec ( bool  create_new_tablespace,
uint64_t  min_expected_size,
bool  supports_raw_devices 
)

Check the data file specification.

Parameters
[in]create_new_tablespaceTrue if a new tablespace is to be created
[in]min_expected_sizeMinimum expected tablespace size in bytes
[in]supports_raw_devicesTrue if the tablespace supports raw devices.
Returns
DB_SUCCESS if all OK else error code

◆ check_size()

dberr_t ib::fsp::SysTablespace::check_size ( SysTablespace_node node,
const ib::fil::Tablespaces_nodes_interface::Node_info node_info 
)
private

Verify the size of the node storage.

Parameters
[in]nodedata node object
[in]node_infoInformation about the node storage specified.
Returns
DB_SUCCESS if OK else error code.

◆ create_node()

ut::Expected< SysTablespace::Opened_storage_node > ib::fsp::SysTablespace::create_node ( SysTablespace_node node)
private

Create storage for the specified data node.

Parameters
[in,out]nodedata node object. May change value of the m_node_storage_exists member.
Returns
Opened storage node or error code

◆ get_autoextend_increment()

static page_no_t ib::fsp::SysTablespace::get_autoextend_increment ( )
inlinestatic
Returns
the autoextend increment in pages.

◆ get_sum_of_new_sizes_in_pages()

page_no_t ib::fsp::SysTablespace::get_sum_of_new_sizes_in_pages ( ) const
inline
Returns
the sum of the node sizes that were created, in pages.

◆ get_tablespace_full_status()

bool ib::fsp::SysTablespace::get_tablespace_full_status ( )
inline

Get tablespace full status.

Returns
true if table is full

◆ open_node()

ut::Expected< SysTablespace::Opened_storage_node > ib::fsp::SysTablespace::open_node ( const SysTablespace_node node)
private

Open storage of the specified data node.

Parameters
[in]nodedata node object
Returns
Opened storage node or error code

◆ parse_file_name()

char * ib::fsp::SysTablespace::parse_file_name ( char *  ptr)
staticprivate

◆ parse_params()

bool ib::fsp::SysTablespace::parse_params ( const char *  filepath_spec)

Parse the input params and populate member variables.

Parameters
[in]filepath_specpath to data files
Returns
true on success parse

◆ parse_suffixed_page_count()

page_no_t ib::fsp::SysTablespace::parse_suffixed_page_count ( char *&  ptr)
private

Convert a numeric string representing a number of bytes optionally ending in upper or lower case G, M, or K, to a number of megabytes, rounding down to the nearest megabyte.

Then return the number of pages in the file.

Parameters
[in,out]ptrPointer to a numeric string
Returns
the number of pages in the file.

◆ prepare_nodes()

dberr_t ib::fsp::SysTablespace::prepare_nodes ( )

Open or create the data files, register the tablespace and its nodes in the fil's tablespace registry.

Returns
DB_SUCCESS or error code

◆ read_lsn_and_check_flags()

ut::Expected< lsn_t > ib::fsp::SysTablespace::read_lsn_and_check_flags ( )

Check the tablespace header for this tablespace and read the flush LSN.

Returns
value stored at offset FIL_PAGE_FILE_FLUSH_LSN or error code

TODO: Enable following after WL#11063-related comment in fsp_header_validate() is fixed. const auto server_version = fsp_header_get_server_version(page.get()); const auto space_version = fsp_header_get_space_version(page.get());

◆ set_tablespace_full_status()

void ib::fsp::SysTablespace::set_tablespace_full_status ( bool  is_full)
inline

Set tablespace full status.

Parameters
[in]is_fulltrue if full

Member Data Documentation

◆ m_auto_extend_last_file

bool ib::fsp::SysTablespace::m_auto_extend_last_file {}
private

if true, then we auto-extend the last data file

◆ m_is_tablespace_full

bool ib::fsp::SysTablespace::m_is_tablespace_full {}
private

Tablespace full status.

◆ m_last_file_size_in_pages_max

page_no_t ib::fsp::SysTablespace::m_last_file_size_in_pages_max {}
private

if != 0, this tells the max size auto-extending may increase the last data file size

◆ m_sum_of_new_sizes_in_pages

page_no_t ib::fsp::SysTablespace::m_sum_of_new_sizes_in_pages {}
private

Sum of sizes of all nodes, in pages, that had the storage created during this instance lifetime.


The documentation for this class was generated from the following files: