MySQL  8.0.21
Source Code Documentation
rpl_handler.cc File Reference
#include "sql/rpl_handler.h"
#include <string.h>
#include <memory>
#include <new>
#include <unordered_map>
#include <utility>
#include <vector>
#include "lex_string.h"
#include "map_helpers.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_io.h"
#include "my_loglevel.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/plugin.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/psi_base.h"
#include "mysql/service_mysql_alloc.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/item_func.h"
#include "sql/key.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/psi_memory_key.h"
#include "sql/replication.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_mi.h"
#include "sql/set_var.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_parse.h"
#include "sql/sql_plugin.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thr_malloc.h"
#include "sql/transaction_info.h"
#include "sql_string.h"

Classes

struct  Trans_binlog_info
 

Macros

#define FOREACH_OBSERVER(r, f, args)
 
#define FOREACH_OBSERVER_ERROR_OUT(r, f, args, out)
 
#define RESERVE_HEADER_SIZE   32
 

Typedefs

typedef struct Trans_binlog_info Trans_binlog_info
 

Functions

int get_user_var_int (const char *name, long long int *value, int *null_value)
 Get the value of user variable as an integer. More...
 
int get_user_var_real (const char *name, double *value, int *null_value)
 Get the value of user variable as a double precision float number. More...
 
int get_user_var_str (const char *name, char *value, size_t len, unsigned int precision, int *null_value)
 Get the value of user variable as a string. More...
 
int delegates_init ()
 
void delegates_destroy ()
 
static bool se_before_commit (THD *, plugin_ref plugin, void *arg)
 
bool has_cascade_foreign_key (TABLE *table)
 Helper method to check if the given table has 'CASCADE' foreign key or not. More...
 
void prepare_table_info (THD *thd, Trans_table_info *&table_info_list, uint &number_of_tables)
 Helper method to create table information for the hook call. More...
 
static void prepare_transaction_context (THD *thd, Trans_context_info &ctx_info)
 Helper that gathers all table runtime information. More...
 
static bool se_before_rollback (THD *, plugin_ref plugin, void *arg)
 
static bool se_after_commit (THD *, plugin_ref plugin, void *arg)
 
int register_trans_observer (Trans_observer *observer, void *p)
 Register a transaction observer. More...
 
int unregister_trans_observer (Trans_observer *observer, void *)
 Unregister a transaction observer. More...
 
int register_binlog_storage_observer (Binlog_storage_observer *observer, void *p)
 Register a binlog storage observer. More...
 
int unregister_binlog_storage_observer (Binlog_storage_observer *observer, void *)
 Unregister a binlog storage observer. More...
 
int register_server_state_observer (Server_state_observer *observer, void *plugin_var)
 Register a server state observer. More...
 
int unregister_server_state_observer (Server_state_observer *observer, void *)
 Unregister a server state observer. More...
 
int register_binlog_transmit_observer (Binlog_transmit_observer *observer, void *p)
 Register a binlog transmit observer. More...
 
int unregister_binlog_transmit_observer (Binlog_transmit_observer *observer, void *)
 Unregister a binlog transmit observer. More...
 
int register_binlog_relay_io_observer (Binlog_relay_IO_observer *observer, void *p)
 Register a binlog relay IO (slave IO thread) observer. More...
 
int unregister_binlog_relay_io_observer (Binlog_relay_IO_observer *observer, void *)
 Unregister a binlog relay IO (slave IO thread) observer. More...
 
int launch_hook_trans_begin (THD *thd, TABLE_LIST *all_tables)
 

Variables

Trans_delegatetransaction_delegate
 
Binlog_storage_delegatebinlog_storage_delegate
 
Server_state_delegateserver_state_delegate
 
Binlog_transmit_delegatebinlog_transmit_delegate
 
Binlog_relay_IO_delegatebinlog_relay_io_delegate
 

Macro Definition Documentation

◆ FOREACH_OBSERVER

#define FOREACH_OBSERVER (   r,
  f,
  args 
)

◆ FOREACH_OBSERVER_ERROR_OUT

#define FOREACH_OBSERVER_ERROR_OUT (   r,
  f,
  args,
  out 
)

◆ RESERVE_HEADER_SIZE

#define RESERVE_HEADER_SIZE   32

Typedef Documentation

◆ Trans_binlog_info

Function Documentation

◆ delegates_destroy()

void delegates_destroy ( )

◆ delegates_init()

int delegates_init ( )

◆ get_user_var_int()

int get_user_var_int ( const char *  name,
long long int *  value,
int *  null_value 
)

Get the value of user variable as an integer.

This function will return the value of variable name as an integer. If the original value of the variable is not an integer, the value will be converted into an integer.

Parameters
nameuser variable name
valuepointer to return the value
null_valueif not NULL, the function will set it to true if the value of variable is null, set to false if not
Return values
0Success
1Variable not found

◆ get_user_var_real()

int get_user_var_real ( const char *  name,
double *  value,
int *  null_value 
)

Get the value of user variable as a double precision float number.

This function will return the value of variable name as real number. If the original value of the variable is not a real number, the value will be converted into a real number.

Parameters
nameuser variable name
valuepointer to return the value
null_valueif not NULL, the function will set it to true if the value of variable is null, set to false if not
Return values
0Success
1Variable not found

◆ get_user_var_str()

int get_user_var_str ( const char *  name,
char *  value,
size_t  len,
unsigned int  precision,
int *  null_value 
)

Get the value of user variable as a string.

This function will return the value of variable name as string. If the original value of the variable is not a string, the value will be converted into a string.

Parameters
nameuser variable name
valuepointer to the value buffer
lenlength of the value buffer
precisionprecision of the value if it is a float number
null_valueif not NULL, the function will set it to true if the value of variable is null, set to false if not
Return values
0Success
1Variable not found

◆ has_cascade_foreign_key()

bool has_cascade_foreign_key ( TABLE table)

Helper method to check if the given table has 'CASCADE' foreign key or not.

Parameters
[in]tableTable object that needs to be verified.
Returns
bool true If the table has 'CASCADE' foreign key. false If the table does not have 'CASCADE' foreign key.

◆ launch_hook_trans_begin()

int launch_hook_trans_begin ( THD thd,
TABLE_LIST all_tables 
)

◆ prepare_table_info()

void prepare_table_info ( THD thd,
Trans_table_info *&  table_info_list,
uint number_of_tables 
)

Helper method to create table information for the hook call.

◆ prepare_transaction_context()

static void prepare_transaction_context ( THD thd,
Trans_context_info ctx_info 
)
static

Helper that gathers all table runtime information.

Parameters
[in]thdthe current execution thread
[out]ctx_infoTrans_context_info in which the result is stored.

◆ register_binlog_relay_io_observer()

int register_binlog_relay_io_observer ( Binlog_relay_IO_observer observer,
void *  p 
)

Register a binlog relay IO (slave IO thread) observer.

Parameters
observerThe binlog relay IO observer to register
ppointer to the internal plugin structure
Return values
0Sucess
1Observer already exists

◆ register_binlog_storage_observer()

int register_binlog_storage_observer ( Binlog_storage_observer observer,
void *  p 
)

Register a binlog storage observer.

Parameters
observerThe binlog storage observer to register
ppointer to the internal plugin structure
Return values
0Sucess
1Observer already exists

◆ register_binlog_transmit_observer()

int register_binlog_transmit_observer ( Binlog_transmit_observer observer,
void *  p 
)

Register a binlog transmit observer.

Parameters
observerThe binlog transmit observer to register
ppointer to the internal plugin structure
Return values
0Sucess
1Observer already exists

◆ register_server_state_observer()

int register_server_state_observer ( Server_state_observer observer,
void *  p 
)

Register a server state observer.

Parameters
observerThe server state observer to register
ppointer to the internal plugin structure
Return values
0Success
1Observer already exists

◆ register_trans_observer()

int register_trans_observer ( Trans_observer observer,
void *  p 
)

Register a transaction observer.

Parameters
observerThe transaction observer to register
ppointer to the internal plugin structure
Return values
0Sucess
1Observer already exists

◆ se_after_commit()

static bool se_after_commit ( THD ,
plugin_ref  plugin,
void *  arg 
)
static

◆ se_before_commit()

static bool se_before_commit ( THD ,
plugin_ref  plugin,
void *  arg 
)
static

◆ se_before_rollback()

static bool se_before_rollback ( THD ,
plugin_ref  plugin,
void *  arg 
)
static

◆ unregister_binlog_relay_io_observer()

int unregister_binlog_relay_io_observer ( Binlog_relay_IO_observer observer,
void *  p 
)

Unregister a binlog relay IO (slave IO thread) observer.

Parameters
observerThe binlog relay IO observer to unregister
ppointer to the internal plugin structure
Return values
0Sucess
1Observer not exists

◆ unregister_binlog_storage_observer()

int unregister_binlog_storage_observer ( Binlog_storage_observer observer,
void *  p 
)

Unregister a binlog storage observer.

Parameters
observerThe binlog storage observer to unregister
ppointer to the internal plugin structure
Return values
0Sucess
1Observer not exists

◆ unregister_binlog_transmit_observer()

int unregister_binlog_transmit_observer ( Binlog_transmit_observer observer,
void *  p 
)

Unregister a binlog transmit observer.

Parameters
observerThe binlog transmit observer to unregister
ppointer to the internal plugin structure
Return values
0Sucess
1Observer not exists

◆ unregister_server_state_observer()

int unregister_server_state_observer ( Server_state_observer observer,
void *  p 
)

Unregister a server state observer.

Parameters
observerThe server state observer to unregister
ppointer to the internal plugin structure
Return values
0Success
1Observer not exists

◆ unregister_trans_observer()

int unregister_trans_observer ( Trans_observer observer,
void *  p 
)

Unregister a transaction observer.

Parameters
observerThe transaction observer to unregister
ppointer to the internal plugin structure
Return values
0Sucess
1Observer not exists

Variable Documentation

◆ binlog_relay_io_delegate

Binlog_relay_IO_delegate* binlog_relay_io_delegate

◆ binlog_storage_delegate

Binlog_storage_delegate* binlog_storage_delegate

◆ binlog_transmit_delegate

Binlog_transmit_delegate* binlog_transmit_delegate

◆ server_state_delegate

Server_state_delegate* server_state_delegate

◆ transaction_delegate

Trans_delegate* transaction_delegate