MySQL 9.0.0
Source Code Documentation
clone0api.h File Reference

Innodb Clone Interface. More...

#include "univ.i"
#include "sql/handler.h"

Go to the source code of this file.

Classes

class  Clone_notify
 Clone Notification handler. More...
 

Functions

void innodb_clone_get_capability (Ha_clone_flagset &flags)
 Get capability flags for clone operation. More...
 
int innodb_clone_begin (handlerton *hton, THD *thd, const byte *&loc, uint &loc_len, uint &task_id, Ha_clone_type type, Ha_clone_mode mode)
 Begin copy from source database. More...
 
int innodb_clone_copy (handlerton *hton, THD *thd, const byte *loc, uint loc_len, uint task_id, Ha_clone_cbk *cbk)
 Copy data from source database in chunks via callback. More...
 
int innodb_clone_ack (handlerton *hton, THD *thd, const byte *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)
 Acknowledge data to source database. More...
 
int innodb_clone_end (handlerton *hton, THD *thd, const byte *loc, uint loc_len, uint task_id, int in_err)
 End copy from source database. More...
 
int innodb_clone_apply_begin (handlerton *hton, THD *thd, const byte *&loc, uint &loc_len, uint &task_id, Ha_clone_mode mode, const char *data_dir)
 Begin apply to destination database. More...
 
int innodb_clone_apply (handlerton *hton, THD *thd, const byte *loc, uint loc_len, uint task_id, int in_err, Ha_clone_cbk *cbk)
 Apply data to destination database in chunks via callback. More...
 
int innodb_clone_apply_end (handlerton *hton, THD *thd, const byte *loc, uint loc_len, uint task_id, int in_err)
 End apply to destination database. More...
 
void clone_init_list_files ()
 Check and delete any old list files. More...
 
int clone_add_to_list_file (const char *list_file_name, const char *file_name)
 Add file name to clone list file for future replacement or rollback. More...
 
void clone_remove_list_file (const char *file_name)
 Remove one of the clone list files. More...
 
void clone_files_error ()
 Revert back clone changes in case of an error. More...
 
bool clone_check_recovery_crashpoint (bool is_cloned_db)
 Debug function to check and crash during recovery. More...
 
void clone_files_recovery (bool finished)
 Change cloned file states during recovery. More...
 
void clone_update_gtid_status (std::string &gtids)
 Update cloned GTIDs to recovery status file. More...
 
dberr_t clone_init ()
 Initialize Clone system. More...
 
void clone_free ()
 Uninitialize Clone system. More...
 
bool clone_check_active ()
 Check if active clone is running. More...
 
bool clone_check_provisioning ()
 
bool fix_cloned_tables (THD *thd)
 Fix cloned non-Innodb tables during recovery. More...
 

Detailed Description

Innodb Clone Interface.

Function Documentation

◆ clone_add_to_list_file()

int clone_add_to_list_file ( const char *  list_file_name,
const char *  file_name 
)

Add file name to clone list file for future replacement or rollback.

Parameters
[in]list_file_namelist file name where to add the file
[in]file_namefile name to add to the list
Returns
error code

◆ clone_check_active()

bool clone_check_active ( )

Check if active clone is running.

Returns
true, if any active clone is found.

◆ clone_check_provisioning()

bool clone_check_provisioning ( )
Returns
true, if clone provisioning in progress.

◆ clone_check_recovery_crashpoint()

bool clone_check_recovery_crashpoint ( bool  is_cloned_db)

Debug function to check and crash during recovery.

Parameters
[in]is_cloned_dbif cloned database recovery

◆ clone_files_error()

void clone_files_error ( )

Revert back clone changes in case of an error.

◆ clone_files_recovery()

void clone_files_recovery ( bool  finished)

Change cloned file states during recovery.

Parameters
[in]finishedif recovery is finishing

◆ clone_free()

void clone_free ( )

Uninitialize Clone system.

◆ clone_init()

dberr_t clone_init ( )

Initialize Clone system.

Returns
inndodb error code

◆ clone_init_list_files()

void clone_init_list_files ( )

Check and delete any old list files.

◆ clone_remove_list_file()

void clone_remove_list_file ( const char *  file_name)

Remove one of the clone list files.

Parameters
[in]file_namelist file name to delete

◆ clone_update_gtid_status()

void clone_update_gtid_status ( std::string &  gtids)

Update cloned GTIDs to recovery status file.

Parameters
[in]gtidscloned GTIDs

◆ fix_cloned_tables()

bool fix_cloned_tables ( THD thd)

Fix cloned non-Innodb tables during recovery.

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

◆ innodb_clone_ack()

int innodb_clone_ack ( handlerton hton,
THD thd,
const byte loc,
uint  loc_len,
uint  task_id,
int  in_err,
Ha_clone_cbk cbk 
)

Acknowledge data to source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errinform any error occurred
[in]cbkcallback interface for receiving data
Returns
error code

◆ innodb_clone_apply()

int innodb_clone_apply ( handlerton hton,
THD thd,
const byte loc,
uint  loc_len,
uint  task_id,
int  in_err,
Ha_clone_cbk cbk 
)

Apply data to destination database in chunks via callback.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errinform any error occurred
[in]cbkcallback interface for receiving data
Returns
error code

◆ innodb_clone_apply_begin()

int innodb_clone_apply_begin ( handlerton hton,
THD thd,
const byte *&  loc,
uint &  loc_len,
uint &  task_id,
Ha_clone_mode  mode,
const char *  data_dir 
)

Begin apply to destination database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in,out]loclocator
[in,out]loc_lenlocator length
[out]task_idtask identifier
[in]modemode for starting clone
[in]data_dirtarget data directory
Returns
error code

◆ innodb_clone_apply_end()

int innodb_clone_apply_end ( handlerton hton,
THD thd,
const byte loc,
uint  loc_len,
uint  task_id,
int  in_err 
)

End apply to destination database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errerror code when ending after error
Returns
error code

◆ innodb_clone_begin()

int innodb_clone_begin ( handlerton hton,
THD thd,
const byte *&  loc,
uint &  loc_len,
uint &  task_id,
Ha_clone_type  type,
Ha_clone_mode  mode 
)

Begin copy from source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in,out]loclocator
[in,out]loc_lenlocator length
[out]task_idtask identifier
[in]typeclone type
[in]modemode for starting clone
Returns
error code

◆ innodb_clone_copy()

int innodb_clone_copy ( handlerton hton,
THD thd,
const byte loc,
uint  loc_len,
uint  task_id,
Ha_clone_cbk cbk 
)

Copy data from source database in chunks via callback.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]cbkcallback interface for sending data
Returns
error code

◆ innodb_clone_end()

int innodb_clone_end ( handlerton hton,
THD thd,
const byte loc,
uint  loc_len,
uint  task_id,
int  in_err 
)

End copy from source database.

Parameters
[in]htonhandlerton for SE
[in]thdserver thread handle
[in]loclocator
[in]loc_lenlocator length in bytes
[in]task_idtask identifier
[in]in_errerror code when ending after error
Returns
error code

◆ innodb_clone_get_capability()

void innodb_clone_get_capability ( Ha_clone_flagset flags)

Get capability flags for clone operation.

Parameters
[out]flagscapability flag