MySQL 8.4.2
Source Code Documentation
Tablespace_dirs Class Reference

Directories scanned during startup and the files discovered. More...

Public Types

using Result = std::pair< std::string, Tablespace_files::Names * >
 

Public Member Functions

 Tablespace_dirs ()
 Constructor. More...
 
void set_scan_dir (const std::string &directory, bool is_undo_dir=false)
 Normalize and save a directory to scan for IBD and IBU datafiles before recovery. More...
 
void set_scan_dirs (const std::string &directories)
 Normalize and save a list of directories to scan for IBD and IBU datafiles before recovery. More...
 
dberr_t scan ()
 Discover tablespaces by reading the header from .ibd files. More...
 
void clear ()
 Clear all the tablespace file data but leave the list of scanned directories in place. More...
 
bool erase_path (space_id_t space_id)
 Erase a space ID to filename mapping. More...
 
Result find_by_id (space_id_t space_id)
 
Result find_by_num (space_id_t space_num, space_id_t &space_id)
 
bool contains (const std::string &path) const
 Determine if this Fil_path contains the path provided. More...
 
std::string get_dirs () const
 Get the list of directories that InnoDB knows about. More...
 

Private Types

using Scanned = std::vector< Tablespace_files >
 first=dir path from the user, second=files found under first. More...
 
using Const_iter = Scanned_files::const_iterator
 

Private Member Functions

void print_duplicates (const Space_id_set &duplicates)
 Print the duplicate filenames for a tablespace ID to the log. More...
 
void warn_ignore (std::string path_in, const char *reason)
 Report a warning that a path is being ignored and include the reason. More...
 
void add_path (const std::string &str, bool is_undo_dir=false)
 Add a single path specification to this list of tablespace directories. More...
 
void add_paths (const std::string &str, const std::string &delimiters)
 Add a delimited list of path specifications to this list of tablespace directories. More...
 
void duplicate_check (const Const_iter &start, const Const_iter &end, size_t thread_id, std::mutex *mutex, Space_id_set *unique, Space_id_set *duplicates)
 Check for duplicate tablespace IDs. More...
 

Private Attributes

Scanned m_dirs
 Directories scanned and the files discovered under them. More...
 
std::atomic_size_t m_checked
 Number of files checked. More...
 

Detailed Description

Directories scanned during startup and the files discovered.

Member Typedef Documentation

◆ Const_iter

using Tablespace_dirs::Const_iter = Scanned_files::const_iterator
private

◆ Result

using Tablespace_dirs::Result = std::pair<std::string, Tablespace_files::Names *>

◆ Scanned

using Tablespace_dirs::Scanned = std::vector<Tablespace_files>
private

first=dir path from the user, second=files found under first.

Constructor & Destructor Documentation

◆ Tablespace_dirs()

Tablespace_dirs::Tablespace_dirs ( )
inline

Constructor.

Member Function Documentation

◆ add_path()

void Tablespace_dirs::add_path ( const std::string &  str,
bool  is_undo_dir = false 
)
private

Add a single path specification to this list of tablespace directories.

Convert it to an absolute path. Check if the path is valid. Ignore unreadable, duplicate or invalid directories.

Parameters
[in]strPath specification to tokenize
[in]is_undo_dirtrue for an undo directory

◆ add_paths()

void Tablespace_dirs::add_paths ( const std::string &  str,
const std::string &  delimiters 
)
private

Add a delimited list of path specifications to this list of tablespace directories.

Convert relative paths to absolute paths. Check if the paths are valid. Ignore unreadable, duplicate or invalid directories.

Parameters
[in]strPath specification to tokenize
[in]delimitersDelimiters

◆ clear()

void Tablespace_dirs::clear ( )
inline

Clear all the tablespace file data but leave the list of scanned directories in place.

◆ contains()

bool Tablespace_dirs::contains ( const std::string &  path) const
inline

Determine if this Fil_path contains the path provided.

Parameters
[in]pathfile or directory path to compare.
Returns
true if this Fil_path contains path

◆ duplicate_check()

void Tablespace_dirs::duplicate_check ( const Const_iter start,
const Const_iter end,
size_t  thread_id,
std::mutex *  mutex,
Space_id_set unique,
Space_id_set duplicates 
)
private

Check for duplicate tablespace IDs.

Parameters
[in]startStart of slice
[in]endEnd of slice
[in]thread_idThread ID
[in,out]mutexMutex protecting the global state
[in,out]uniqueTo check for duplicates
[in,out]duplicatesDuplicate space IDs found

◆ erase_path()

bool Tablespace_dirs::erase_path ( space_id_t  space_id)
inline

Erase a space ID to filename mapping.

Parameters
[in]space_idTablespace ID to erase
Returns
true if successful

◆ find_by_id()

Result Tablespace_dirs::find_by_id ( space_id_t  space_id)
inline

◆ find_by_num()

Result Tablespace_dirs::find_by_num ( space_id_t  space_num,
space_id_t space_id 
)
inline

◆ get_dirs()

std::string Tablespace_dirs::get_dirs ( ) const
inline

Get the list of directories that InnoDB knows about.

Returns
the list of directories 'dir1;dir2;....;dirN'

◆ print_duplicates()

void Tablespace_dirs::print_duplicates ( const Space_id_set duplicates)
private

Print the duplicate filenames for a tablespace ID to the log.

Print the duplicate filenames for a tablespce ID to the log.

Parameters
[in]duplicatesDuplicate tablespace IDs

◆ scan()

dberr_t Tablespace_dirs::scan ( )

Discover tablespaces by reading the header from .ibd files.

Returns
DB_SUCCESS if all goes well

◆ set_scan_dir()

void Tablespace_dirs::set_scan_dir ( const std::string &  directory,
bool  is_undo_dir = false 
)

Normalize and save a directory to scan for IBD and IBU datafiles before recovery.

Parameters
[in]directorydirectory to scan for ibd and ibu files
[in]is_undo_dirtrue for an undo directory

◆ set_scan_dirs()

void Tablespace_dirs::set_scan_dirs ( const std::string &  directories)

Normalize and save a list of directories to scan for IBD and IBU datafiles before recovery.

Parameters
[in]directoriesDirectories to scan for ibd and ibu files

◆ warn_ignore()

void Tablespace_dirs::warn_ignore ( std::string  path_in,
const char *  reason 
)
private

Report a warning that a path is being ignored and include the reason.

Member Data Documentation

◆ m_checked

std::atomic_size_t Tablespace_dirs::m_checked
private

Number of files checked.

◆ m_dirs

Scanned Tablespace_dirs::m_dirs
private

Directories scanned and the files discovered under them.


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