MySQL 8.0.39
Source Code Documentation
Clone_handler Class Reference

Clone plugin handler to convenient way to. More...

#include <clone_handler.h>

Classes

struct  XA_Block
 
struct  XA_Operation
 

Public Member Functions

 Clone_handler (const char *plugin_name_arg)
 Constructor: Initialize plugin name. More...
 
int init ()
 Initialize plugin handle. More...
 
int clone_local (THD *thd, const char *data_dir)
 Clone handler interface for local clone. More...
 
int clone_remote_client (THD *thd, const char *remote_host, uint remote_port, const char *remote_user, const char *remote_passwd, const char *data_dir, enum mysql_ssl_mode ssl_mode)
 Clone handler interface for remote clone client. More...
 
int clone_remote_server (THD *thd, MYSQL_SOCKET socket)
 Clone handler interface for remote clone server. More...
 

Static Public Member Functions

static bool get_donor_error (Srv_session *session, int &error, const char *&message)
 Get donor error and message for ER_CLONE_DONOR error. More...
 
static bool is_data_dropped ()
 
static void set_drop_data ()
 Must set before dropping any user data. More...
 
static bool is_provisioning ()
 
static bool need_commit_order ()
 
static void init_xa ()
 
static void uninit_xa ()
 

Private Member Functions

int validate_dir (const char *in_dir, char *out_dir)
 Validate clone data directory and convert to os format. More...
 

Static Private Member Functions

static bool block_xa_operation (THD *thd)
 Block new active XA operations and wait for existing ones to complete. More...
 
static void unblock_xa_operation ()
 Unblock waiting XA operations. More...
 
static void begin_xa_operation (THD *thd)
 Increment XA operation count and wait if blocked by clone. More...
 
static void end_xa_operation ()
 Decrement XA operation count. More...
 

Private Attributes

std::string m_plugin_name
 Clone plugin name. More...
 
Mysql_clonem_plugin_handle
 Clone plugin handle. More...
 

Static Private Attributes

static std::atomic< int > s_xa_counter {0}
 Number of XA operations (prepare/commit/rollback) in progress. More...
 
static std::atomic< bool > s_xa_block_op {false}
 Set when clone blocks XA operations. More...
 
static std::atomic< int > s_provision_in_progress {0}
 True if clone provisioning in progress. More...
 
static std::atomic< bool > s_is_data_dropped {false}
 True, if any user data is dropped by clone. More...
 
static mysql_mutex_t s_xa_mutex
 Mutex to synchronize blocking XA operation. More...
 

Detailed Description

Clone plugin handler to convenient way to.

Takes

Constructor & Destructor Documentation

◆ Clone_handler()

Clone_handler::Clone_handler ( const char *  plugin_name_arg)
inline

Constructor: Initialize plugin name.

Member Function Documentation

◆ begin_xa_operation()

void Clone_handler::begin_xa_operation ( THD thd)
staticprivate

Increment XA operation count and wait if blocked by clone.

Parameters
[in]thdsession thread

◆ block_xa_operation()

bool Clone_handler::block_xa_operation ( THD thd)
staticprivate

Block new active XA operations and wait for existing ones to complete.

Parameters
[in]thdsession thread

◆ clone_local()

int Clone_handler::clone_local ( THD thd,
const char *  data_dir 
)

Clone handler interface for local clone.

Parameters
[in]thdserver thread handle
[in]data_dircloned data directory
Returns
error code

◆ clone_remote_client()

int Clone_handler::clone_remote_client ( THD thd,
const char *  remote_host,
uint  remote_port,
const char *  remote_user,
const char *  remote_passwd,
const char *  data_dir,
enum mysql_ssl_mode  ssl_mode 
)

Clone handler interface for remote clone client.

Parameters
[in]thdserver thread handle
[in]remote_hostremote host IP address
[in]remote_portremote server port
[in]remote_userremote user name
[in]remote_passwdremote user's password
[in]data_dircloned data directory
[in]ssl_moderemote connection ssl mode
Returns
error code

◆ clone_remote_server()

int Clone_handler::clone_remote_server ( THD thd,
MYSQL_SOCKET  socket 
)

Clone handler interface for remote clone server.

Parameters
[in]thdserver thread handle
[in]socketnetwork socket to remote client
Returns
error code

◆ end_xa_operation()

void Clone_handler::end_xa_operation ( )
staticprivate

Decrement XA operation count.

◆ get_donor_error()

bool Clone_handler::get_donor_error ( Srv_session session,
int &  error,
const char *&  message 
)
static

Get donor error and message for ER_CLONE_DONOR error.

Parameters
[in]sessionserver session
[out]errordonor error number
[out]messageerror message
Returns
true, iff successful.

◆ init()

int Clone_handler::init ( )

Initialize plugin handle.

Returns
error code

◆ init_xa()

void Clone_handler::init_xa ( )
static

◆ is_data_dropped()

static bool Clone_handler::is_data_dropped ( )
inlinestatic
Returns
false only if no user data is dropped yet.

◆ is_provisioning()

static bool Clone_handler::is_provisioning ( )
inlinestatic
Returns
true, if clone provisioning in progress.

◆ need_commit_order()

static bool Clone_handler::need_commit_order ( )
inlinestatic
Returns
true, if ordered commit should be forced. Currently clone would force ordered commit at end while blocking XA operations

◆ set_drop_data()

static void Clone_handler::set_drop_data ( )
inlinestatic

Must set before dropping any user data.

◆ unblock_xa_operation()

void Clone_handler::unblock_xa_operation ( )
staticprivate

Unblock waiting XA operations.

◆ uninit_xa()

void Clone_handler::uninit_xa ( )
static

◆ validate_dir()

int Clone_handler::validate_dir ( const char *  in_dir,
char *  out_dir 
)
private

Validate clone data directory and convert to os format.

Parameters
[in]in_diruser specified clone directory
[out]out_dirdata directory in native os format
Returns
error code

Member Data Documentation

◆ m_plugin_handle

Mysql_clone* Clone_handler::m_plugin_handle
private

Clone plugin handle.

◆ m_plugin_name

std::string Clone_handler::m_plugin_name
private

Clone plugin name.

◆ s_is_data_dropped

std::atomic< bool > Clone_handler::s_is_data_dropped {false}
staticprivate

True, if any user data is dropped by clone.

◆ s_provision_in_progress

std::atomic< int > Clone_handler::s_provision_in_progress {0}
staticprivate

True if clone provisioning in progress.

◆ s_xa_block_op

std::atomic< bool > Clone_handler::s_xa_block_op {false}
staticprivate

Set when clone blocks XA operations.

XA operations currently are not ordered between binlog and SE and needs to be synchronized for clone.

◆ s_xa_counter

std::atomic< int > Clone_handler::s_xa_counter {0}
staticprivate

Number of XA operations (prepare/commit/rollback) in progress.

◆ s_xa_mutex

mysql_mutex_t Clone_handler::s_xa_mutex
staticprivate

Mutex to synchronize blocking XA operation.


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