MySQL 9.1.0
Source Code Documentation
|
Clone System. More...
#include <clone0clone.h>
Classes | |
class | Acquire_clone |
class | Wait_stage |
RAII style wrapper to enter and exit wait stage. More... | |
Public Types | |
using | Wait_Cond_Cbk_Func = std::function< int(bool is_alert, bool &result)> |
Function to check wait condition. More... | |
Public Member Functions | |
Clone_Sys () | |
Construct clone system. More... | |
~Clone_Sys () | |
Destructor: Call during system shutdown. More... | |
int | add_clone (const byte *loc, Clone_Handle_Type hdl_type, Clone_Handle *&clone_hdl) |
Create and add a new clone handle to clone system. More... | |
void | drop_clone (Clone_Handle *clone_handle) |
drop a clone handle from clone system More... | |
Clone_Handle * | find_clone (const byte *ref_loc, uint loc_len, Clone_Handle_Type hdl_type) |
Find if a clone is already running for the reference locator. More... | |
Clone_Handle * | get_clone_by_index (const byte *loc, uint loc_len) |
Get the clone handle from locator by index. More... | |
int | attach_snapshot (Clone_Handle_Type hdl_type, Ha_clone_type clone_type, uint64_t snapshot_id, bool is_pfs_monitor, Clone_Snapshot *&snapshot) |
Get or create a snapshot for clone and attach. More... | |
void | detach_snapshot (Clone_Snapshot *snapshot, Clone_Handle_Type hdl_type) |
Detach clone handle from snapshot. More... | |
bool | mark_abort (bool force) |
Mark clone state to abort if no active clone. More... | |
void | mark_active () |
Mark clone state to active if no other abort request. More... | |
void | mark_wait () |
Mark to indicate that new clone operations should wait. More... | |
void | mark_free () |
Free the wait marker. More... | |
void | debug_wait_clone_begin () |
Debug wait while starting clone and waiting for free marker. More... | |
void | close_donor_master_file () |
Close donor master task file if open and unpin. More... | |
int | wait_for_free (THD *thd) |
Wait for marker to get freed. More... | |
bool | begin_ddl_state (Clone_notify::Type type, space_id_t space, bool no_wait, bool check_intr, uint32_t &blocked_state, int &error) |
Begin restricted state during some critical ddl phase. More... | |
void | end_ddl_state (Clone_notify::Type type, space_id_t space, uint32_t blocked_state) |
End restricted state during some critical ddl phase. More... | |
uint64_t | get_next_id () |
Get next unique ID. More... | |
ib_mutex_t * | get_mutex () |
Get clone sys mutex. More... | |
bool | check_active_clone (bool print_alert) |
Check if any active clone is running. More... | |
std::tuple< bool, Clone_Handle * > | check_active_clone () |
Check if any active clone is running. More... | |
Clone_persist_gtid & | get_gtid_persistor () |
void | set_space_initialized () |
Remember that all innodb spaces are initialized after last startup. More... | |
bool | is_space_initialized () const |
Static Public Member Functions | |
static int | wait (Clone_Msec sleep_time, Clone_Sec timeout, Clone_Sec alert_interval, Wait_Cond_Cbk_Func &&func, ib_mutex_t *mutex, bool &is_timeout) |
Wait till the condition is satisfied or timeout. More... | |
static int | wait_default (Wait_Cond_Cbk_Func &&func, ib_mutex_t *mutex, bool &is_timeout) |
Wait till the condition is satisfied or default timeout. More... | |
Static Public Attributes | |
static Clone_Sys_State | s_clone_sys_state = {CLONE_SYS_INACTIVE} |
Clone System state. More... | |
static uint | s_clone_abort_count = 0 |
Number of active abort requests. More... | |
static uint | s_clone_wait_count = 0 |
Number of active wait requests. More... | |
Private Member Functions | |
int | find_free_index (Clone_Handle_Type hdl_type, uint &free_index) |
Find free index to allocate new clone handle. More... | |
bool | handle_ddl_state (Clone_notify::Type type, space_id_t space, bool begin) |
Handle restricted state during critical ddl phase. More... | |
Private Attributes | |
Clone_Handle * | m_clone_arr [CLONE_ARR_SIZE] |
Array of clone handles. More... | |
uint | m_num_clones |
Number of copy clones. More... | |
uint | m_num_apply_clones |
Number of apply clones. More... | |
Clone_Snapshot * | m_snapshot_arr [SNAPSHOT_ARR_SIZE] |
Array of clone snapshots. More... | |
uint | m_num_snapshots |
Number of copy snapshots. More... | |
uint | m_num_apply_snapshots |
Number of apply snapshots. More... | |
ib_mutex_t | m_clone_sys_mutex |
Clone system mutex. More... | |
uint64_t | m_clone_id_generator |
Clone unique ID generator. More... | |
std::atomic< bool > | m_space_initialized |
If all innodb tablespaces are initialized. More... | |
Clone_persist_gtid | m_gtid_persister |
GTID persister. More... | |
Clone System.
using Clone_Sys::Wait_Cond_Cbk_Func = std::function<int(bool is_alert, bool &result)> |
Function to check wait condition.
[in] | is_alert | print alert message |
[out] | result | true, if condition is satisfied |
Clone_Sys::Clone_Sys | ( | ) |
Construct clone system.
Clone_Sys::~Clone_Sys | ( | ) |
Destructor: Call during system shutdown.
int Clone_Sys::add_clone | ( | const byte * | loc, |
Clone_Handle_Type | hdl_type, | ||
Clone_Handle *& | clone_hdl | ||
) |
Create and add a new clone handle to clone system.
[in] | loc | locator |
[in] | hdl_type | handle type |
[out] | clone_hdl | clone handle |
int Clone_Sys::attach_snapshot | ( | Clone_Handle_Type | hdl_type, |
Ha_clone_type | clone_type, | ||
uint64_t | snapshot_id, | ||
bool | is_pfs_monitor, | ||
Clone_Snapshot *& | snapshot | ||
) |
Get or create a snapshot for clone and attach.
[in] | hdl_type | handle type |
[in] | clone_type | clone type |
[in] | snapshot_id | snapshot identifier |
[in] | is_pfs_monitor | true, if needs PFS monitoring |
[out] | snapshot | clone snapshot |
bool Clone_Sys::begin_ddl_state | ( | Clone_notify::Type | type, |
space_id_t | space, | ||
bool | no_wait, | ||
bool | check_intr, | ||
uint32_t & | blocked_state, | ||
int & | error | ||
) |
Begin restricted state during some critical ddl phase.
[in] | type | ddl notification type |
[in] | space | tablespace ID for which notification is sent |
[in] | no_wait | return with error if needs to wait |
[in] | check_intr | check for interrupt during wait |
[out] | blocked_state | blocked state when state change is blocked |
[out] | error | mysql error code |
std::tuple< bool, Clone_Handle * > Clone_Sys::check_active_clone | ( | ) |
Check if any active clone is running.
bool Clone_Sys::check_active_clone | ( | bool | print_alert | ) |
Check if any active clone is running.
[in] | print_alert | print alert message |
void Clone_Sys::close_donor_master_file | ( | ) |
Close donor master task file if open and unpin.
void Clone_Sys::debug_wait_clone_begin | ( | ) |
Debug wait while starting clone and waiting for free marker.
void Clone_Sys::detach_snapshot | ( | Clone_Snapshot * | snapshot, |
Clone_Handle_Type | hdl_type | ||
) |
Detach clone handle from snapshot.
[in] | snapshot | snapshot |
[in] | hdl_type | handle type |
void Clone_Sys::drop_clone | ( | Clone_Handle * | clone_handle | ) |
drop a clone handle from clone system
[in] | clone_handle | Clone handle |
void Clone_Sys::end_ddl_state | ( | Clone_notify::Type | type, |
space_id_t | space, | ||
uint32_t | blocked_state | ||
) |
End restricted state during some critical ddl phase.
[in] | type | ddl notification type |
[in] | space | tablespace ID for which notification is sent |
[in] | blocked_state | blocked state when state change is blocked |
Clone_Handle * Clone_Sys::find_clone | ( | const byte * | ref_loc, |
uint | loc_len, | ||
Clone_Handle_Type | hdl_type | ||
) |
Find if a clone is already running for the reference locator.
[in] | ref_loc | reference locator |
[in] | loc_len | reference locator length |
[in] | hdl_type | clone type |
|
private |
Find free index to allocate new clone handle.
[in] | hdl_type | clone handle type |
[out] | free_index | free index in array |
Clone_Handle * Clone_Sys::get_clone_by_index | ( | const byte * | loc, |
uint | loc_len | ||
) |
Get the clone handle from locator by index.
[in] | loc | locator |
[in] | loc_len | locator length in bytes |
|
inline |
|
inline |
Get clone sys mutex.
uint64_t Clone_Sys::get_next_id | ( | ) |
Get next unique ID.
|
private |
Handle restricted state during critical ddl phase.
[in] | type | ddl notification type |
[in] | space | tablespace ID for which notification is sent |
[in] | begin | true, if beginning state false, if ending |
|
inline |
bool Clone_Sys::mark_abort | ( | bool | force | ) |
Mark clone state to abort if no active clone.
If force is set, abort all active clones and set state to abort.
[in] | force | force active clones to abort |
void Clone_Sys::mark_active | ( | ) |
Mark clone state to active if no other abort request.
void Clone_Sys::mark_free | ( | ) |
Free the wait marker.
void Clone_Sys::mark_wait | ( | ) |
Mark to indicate that new clone operations should wait.
|
inline |
Remember that all innodb spaces are initialized after last startup.
|
inlinestatic |
Wait till the condition is satisfied or timeout.
[in] | sleep_time | sleep time in milliseconds |
[in] | timeout | total time to wait in seconds |
[in] | alert_interval | alert interval in seconds |
[in] | func | callback function for condition check |
[in] | mutex | release during sleep and re-acquire |
[out] | is_timeout | true if timeout |
|
inlinestatic |
Wait till the condition is satisfied or default timeout.
[in] | func | callback function for condition check |
[in] | mutex | release during sleep and re-acquire |
[out] | is_timeout | true if timeout |
int Clone_Sys::wait_for_free | ( | THD * | thd | ) |
Wait for marker to get freed.
[in,out] | thd | user session |
|
private |
Array of clone handles.
|
private |
Clone unique ID generator.
|
private |
Clone system mutex.
|
private |
GTID persister.
|
private |
Number of apply clones.
|
private |
Number of apply snapshots.
|
private |
Number of copy clones.
|
private |
Number of copy snapshots.
|
private |
Array of clone snapshots.
|
private |
If all innodb tablespaces are initialized.
|
static |
Number of active abort requests.
|
static |
Clone System state.
|
static |
Number of active wait requests.