MySQL 9.0.0
Source Code Documentation
anonymous_namespace{clone0api.cc}::Fixup_data Class Reference

Fix schema, table and tablespace. More...

Public Member Functions

 Fixup_data (bool concurrent, bool is_drop)
 Constructor. More...
 
template<typename T >
bool fix (THD *thd, const DD_Objs< T > &dd_objects)
 Fix tables for which data is not cloned. More...
 
bool fix_config_tables (THD *thd)
 Remove data cloned from configuration tables which are not relevant in recipient. More...
 
template<>
bool fix_one_object (THD *thd, const dd::Table *table, size_t thread_number)
 
template<>
bool fix_one_object (THD *thd, const dd::Schema *schema, size_t thread_number)
 
template<>
bool fix_one_object (THD *thd, const dd::Tablespace *tablespace, size_t thread_number)
 

Static Public Attributes

static const size_t S_NUM_CONFIG_TABLES = 0
 Number of system configuration tables. More...
 
static const std::array< const char *, S_NUM_CONFIG_TABLESs_config_tables = {}
 Array of configuration tables. More...
 

Private Member Functions

template<typename T >
bool fix_one_object (THD *thd, const T *object, size_t thread_number)
 Check and fix specific DD object. More...
 
template<typename T >
void fix_objects (THD *thd, const DD_Objs_Iter< T > &begin, const DD_Objs_Iter< T > &end, size_t thread_number)
 Check and fix a rangle of DD objects. More...
 
size_t get_num_tasks () const
 
void set_num_tasks (size_t num_entries)
 Calculate and set number of new tasks to spawn. More...
 
bool is_drop () const
 
bool allow_concurrent () const
 
const char * sql_operation ()
 Get the table operation string. More...
 
bool skip_se_tables (enum legacy_db_type type)
 Check if the current SE type should be skipped. More...
 
bool is_performance_schema (const char *schema_name) const
 Check if the schema is performance schema. More...
 
bool is_system_schema (const char *schema_name) const
 Check if the current schema is system schema. More...
 
bool skip_schema_tables (const dd::Table *table, const char *table_name, const char *schema_name)
 Check if the current schema tables needs to be skipped. More...
 
bool skip_schema (const char *schema_name)
 Check if the current schema needs to be skipped. More...
 
bool skip_tablespace (THD *thd, const dd::Tablespace *dd_space)
 Check if the current tablespace needs to be skipped. More...
 
bool execute_sql (THD *thd, const char *schema_name, const char *table_name, const char *tablespace_name, size_t thread_number)
 Form and execute sql command. More...
 
bool failed () const
 

Private Attributes

std::atomic_size_t m_num_errors
 Number of tasks failed. More...
 
size_t m_num_tasks
 Number of tasks. More...
 
bool m_concurrent
 Allow concurrent threads. More...
 
bool m_drop
 If the objects need to be dropped. More...
 

Detailed Description

Fix schema, table and tablespace.

Used for two different purposes.

  1. After recovery from cloned database: A. Create empty data file for non-Innodb tables that are not cloned. B. Create any schema directory that is not present.
  2. Before cloning into current data directory: A. Drop all user tables. B. Drop all user schema C. Drop all user tablespaces.

Constructor & Destructor Documentation

◆ Fixup_data()

anonymous_namespace{clone0api.cc}::Fixup_data::Fixup_data ( bool  concurrent,
bool  is_drop 
)
inline

Constructor.

Parameters
[in]concurrentspawn multiple threads
[in]is_dropthe operation is drop

Member Function Documentation

◆ allow_concurrent()

bool anonymous_namespace{clone0api.cc}::Fixup_data::allow_concurrent ( ) const
inlineprivate
Returns
true, if concurrency is allowed.

◆ execute_sql()

bool anonymous_namespace{clone0api.cc}::Fixup_data::execute_sql ( THD thd,
const char *  schema_name,
const char *  table_name,
const char *  tablespace_name,
size_t  thread_number 
)
private

Form and execute sql command.

Parameters
[in,out]thdcurrent THD
[in]schema_nameschema name
[in]table_nametable name
[in]tablespace_nametablespace name
[in]thread_numbercurrent thread number.

◆ failed()

bool anonymous_namespace{clone0api.cc}::Fixup_data::failed ( ) const
inlineprivate
Returns
true, if any thread has failed.

◆ fix()

template<typename T >
bool anonymous_namespace{clone0api.cc}::Fixup_data::fix ( THD thd,
const DD_Objs< T > &  dd_objects 
)
inline

Fix tables for which data is not cloned.

Parameters
[in,out]thdcurrent THD
[in]dd_objectstable/schema/tablespace from DD
Returns
true if error

◆ fix_config_tables()

bool anonymous_namespace{clone0api.cc}::Fixup_data::fix_config_tables ( THD thd)

Remove data cloned from configuration tables which are not relevant in recipient.

Parameters
[in,out]thdcurrent THD
Returns
true if error

◆ fix_objects()

template<typename T >
void anonymous_namespace{clone0api.cc}::Fixup_data::fix_objects ( THD thd,
const DD_Objs_Iter< T > &  begin,
const DD_Objs_Iter< T > &  end,
size_t  thread_number 
)
private

Check and fix a rangle of DD objects.

Parameters
[in,out]thdcurrent THD
[in]beginfirst element in current slice
[in]endlast element in current slice
[in]thread_numbercurrent thread number.

◆ fix_one_object() [1/4]

template<>
bool anonymous_namespace{clone0api.cc}::Fixup_data::fix_one_object ( THD thd,
const dd::Schema schema,
size_t  thread_number 
)

◆ fix_one_object() [2/4]

template<>
bool anonymous_namespace{clone0api.cc}::Fixup_data::fix_one_object ( THD thd,
const dd::Table table,
size_t  thread_number 
)

◆ fix_one_object() [3/4]

template<>
bool anonymous_namespace{clone0api.cc}::Fixup_data::fix_one_object ( THD thd,
const dd::Tablespace tablespace,
size_t  thread_number 
)

◆ fix_one_object() [4/4]

template<typename T >
bool anonymous_namespace{clone0api.cc}::Fixup_data::fix_one_object ( THD thd,
const T *  object,
size_t  thread_number 
)
private

Check and fix specific DD object.

Parameters
[in,out]thdcurrent THD
[in]objectDD object
[in]thread_numbercurrent thread number.

◆ get_num_tasks()

size_t anonymous_namespace{clone0api.cc}::Fixup_data::get_num_tasks ( ) const
inlineprivate
Returns
number of tasks.

◆ is_drop()

bool anonymous_namespace{clone0api.cc}::Fixup_data::is_drop ( ) const
inlineprivate
Returns
true, if current operation is drop.

◆ is_performance_schema()

bool anonymous_namespace{clone0api.cc}::Fixup_data::is_performance_schema ( const char *  schema_name) const
inlineprivate

Check if the schema is performance schema.

Parameters
[in]schema_nameschema name
Returns
true iff performance schema.

◆ is_system_schema()

bool anonymous_namespace{clone0api.cc}::Fixup_data::is_system_schema ( const char *  schema_name) const
inlineprivate

Check if the current schema is system schema.

Parameters
[in]schema_nameschema name
Returns
true iff system schema.

◆ set_num_tasks()

void anonymous_namespace{clone0api.cc}::Fixup_data::set_num_tasks ( size_t  num_entries)
inlineprivate

Calculate and set number of new tasks to spawn.

Parameters
[in]num_entriesnumber of entries to handle

◆ skip_schema()

bool anonymous_namespace{clone0api.cc}::Fixup_data::skip_schema ( const char *  schema_name)
inlineprivate

Check if the current schema needs to be skipped.

Parameters
[in]schema_nameschema name
Returns
true iff schema needs to be skipped.

◆ skip_schema_tables()

bool anonymous_namespace{clone0api.cc}::Fixup_data::skip_schema_tables ( const dd::Table table,
const char *  table_name,
const char *  schema_name 
)
inlineprivate

Check if the current schema tables needs to be skipped.

Parameters
[in]tableDD table
[in]table_nametable name
[in]schema_nameschema name
Returns
true iff table needs to be skipped.

◆ skip_se_tables()

bool anonymous_namespace{clone0api.cc}::Fixup_data::skip_se_tables ( enum legacy_db_type  type)
inlineprivate

Check if the current SE type should be skipped.

Parameters
[in]typeSE type
Returns
true iff the SE needs to be skipped.

◆ skip_tablespace()

bool anonymous_namespace{clone0api.cc}::Fixup_data::skip_tablespace ( THD thd,
const dd::Tablespace dd_space 
)
inlineprivate

Check if the current tablespace needs to be skipped.

Parameters
[in,out]thdcurrent THD
[in]dd_spacedd tablespace
Returns
true iff tablespace needs to be skipped.

◆ sql_operation()

const char * anonymous_namespace{clone0api.cc}::Fixup_data::sql_operation ( )
inlineprivate

Get the table operation string.

Returns
sql key word for the operation.

Member Data Documentation

◆ m_concurrent

bool anonymous_namespace{clone0api.cc}::Fixup_data::m_concurrent
private

Allow concurrent threads.

◆ m_drop

bool anonymous_namespace{clone0api.cc}::Fixup_data::m_drop
private

If the objects need to be dropped.

◆ m_num_errors

std::atomic_size_t anonymous_namespace{clone0api.cc}::Fixup_data::m_num_errors
private

Number of tasks failed.

◆ m_num_tasks

size_t anonymous_namespace{clone0api.cc}::Fixup_data::m_num_tasks
private

Number of tasks.

◆ s_config_tables

const std::array< const char *, Fixup_data::S_NUM_CONFIG_TABLES > anonymous_namespace{clone0api.cc}::Fixup_data::s_config_tables = {}
static

Array of configuration tables.

◆ S_NUM_CONFIG_TABLES

const size_t anonymous_namespace{clone0api.cc}::Fixup_data::S_NUM_CONFIG_TABLES = 0
static

Number of system configuration tables.


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