MySQL 8.4.0
Source Code Documentation
rpl_source.h File Reference
#include <stddef.h>
#include <string>
#include "my_hostname.h"
#include "my_inttypes.h"
#include "my_thread_local.h"
#include "mysql/gtid/uuid.h"
#include "mysql_com.h"
#include "sql/resource_blocker.h"
#include "sql/sql_const.h"

Go to the source code of this file.

Classes

struct  REPLICA_INFO
 

Functions

resource_blocker::Resourceget_dump_thread_resource ()
 
int register_replica (THD *thd, uchar *packet, size_t packet_length)
 Register slave in 'slave_list' hash table. More...
 
void unregister_replica (THD *thd, bool only_mine, bool need_lock_slave_list)
 
bool show_replicas (THD *thd)
 Execute a SHOW REPLICAS statement. More...
 
Stringget_replica_uuid (THD *thd, String *value)
 An auxiliary function extracts slave UUID. More...
 
bool show_binary_log_status (THD *thd)
 Execute a SHOW BINARY LOG STATUS statement. More...
 
bool show_binlogs (THD *thd)
 Execute a SHOW BINARY LOGS statement. More...
 
void kill_zombie_dump_threads (THD *thd)
 
bool com_binlog_dump_gtid (THD *thd, char *packet, size_t packet_length)
 Process a COM_BINLOG_DUMP_GTID packet. More...
 
bool com_binlog_dump (THD *thd, char *packet, size_t packet_length)
 Process a COM_BINLOG_DUMP packet. More...
 
void mysql_binlog_send (THD *thd, char *log_ident, my_off_t pos, Gtid_set *gtid_set, uint32 flags)
 Low-level function where the dump thread iterates over the binary log and sends events to the slave. More...
 
bool reset_binary_logs_and_gtids (THD *thd, bool unlock_read_lock)
 Execute a RESET BINARY LOGS AND GTIDS statement. More...
 
const user_var_entryget_user_var_from_alternatives (const THD *thd, const std::string alt1, const std::string alt2)
 Read a user variable that may exist under two different names. More...
 

Variables

bool server_id_supplied
 
int max_binlog_dump_events
 
bool opt_sporadic_binlog_dump_fail
 
bool opt_show_replica_auth_info
 

Function Documentation

◆ com_binlog_dump()

bool com_binlog_dump ( THD thd,
char *  packet,
size_t  packet_length 
)

Process a COM_BINLOG_DUMP packet.

This function parses the packet and then calls mysql_binlog_send.

Parameters
thdThe dump thread.
packetThe COM_BINLOG_DUMP packet.
packet_lengthThe length of the packet in bytes.
Return values
trueError
falseSuccess

◆ com_binlog_dump_gtid()

bool com_binlog_dump_gtid ( THD thd,
char *  packet,
size_t  packet_length 
)

Process a COM_BINLOG_DUMP_GTID packet.

This function parses the packet and then calls mysql_binlog_send.

Parameters
thdThe dump thread.
packetThe COM_BINLOG_DUMP_GTID packet.
packet_lengthThe length of the packet in bytes.
Return values
trueError
falseSuccess

◆ get_dump_thread_resource()

resource_blocker::Resource & get_dump_thread_resource ( )

◆ get_replica_uuid()

String * get_replica_uuid ( THD thd,
String value 
)

An auxiliary function extracts slave UUID.

Parameters
[in]thdTHD to access a user variable
[out]valueString to return UUID value.
Returns
if success value is returned else NULL is returned.

◆ get_user_var_from_alternatives()

const user_var_entry * get_user_var_from_alternatives ( const THD thd,
const std::string  alt1,
const std::string  alt2 
)

Read a user variable that may exist under two different names.

Parameters
thdThe session to read from.
alt1The first variable name alternative.
alt2The second variable name alternative.
Return values
Ifthere exists a user variable in the current session with the first name, return that. Otherwise, if the second one exists, return that. Otherwise, return NULL.

◆ kill_zombie_dump_threads()

void kill_zombie_dump_threads ( THD thd)

◆ mysql_binlog_send()

void mysql_binlog_send ( THD thd,
char *  log_ident,
my_off_t  pos,
Gtid_set gtid_set,
uint32  flags 
)

Low-level function where the dump thread iterates over the binary log and sends events to the slave.

This function is common for both COM_BINLOG_DUMP and COM_BINLOG_DUMP_GTID.

Parameters
thdThe dump thread.
log_identThe filename of the binary log, as given in the COM_BINLOG_DUMP[_GTID] packet. If this is is an empty string (first character is '\0'), we start with the oldest binary log.
posThe offset in the binary log, as given in the COM_BINLOG_DUMP[_GTID] packet. This must be at least 4 and at most the size of the binary log file.
gtid_setThe gtid_set that the slave sent, or NULL if the protocol is COM_BINLOG_DUMP.
flagsflags in COM_BINLOG_DUMP[_GTID] packets.
Note
This function will start reading at the given (filename, offset), or from the oldest log if filename[0]==0. It will send all events from that position; but if gtid_set!=NULL, it will skip all events in that set.

◆ register_replica()

int register_replica ( THD thd,
uchar packet,
size_t  packet_length 
)

Register slave in 'slave_list' hash table.

Returns
0 ok
1 Error. Error message sent to client

◆ reset_binary_logs_and_gtids()

bool reset_binary_logs_and_gtids ( THD thd,
bool  unlock_global_read_lock 
)

Execute a RESET BINARY LOGS AND GTIDS statement.

Parameters
thdPointer to THD object of the client thread executing the statement.
unlock_global_read_lockUnlock the global read lock aquired by RESET BINARY LOGS AND GTIDS.
Return values
falsesuccess
trueerror

◆ show_binary_log_status()

bool show_binary_log_status ( THD thd)

Execute a SHOW BINARY LOG STATUS statement.

Parameters
thdPointer to THD object for the client thread executing the statement.
Return values
falsesuccess
truefailure

◆ show_binlogs()

bool show_binlogs ( THD thd)

Execute a SHOW BINARY LOGS statement.

Parameters
thdPointer to THD object for the client thread executing the statement.
Return values
falsesuccess
truefailure

◆ show_replicas()

bool show_replicas ( THD thd)

Execute a SHOW REPLICAS statement.

Parameters
thdPointer to THD object for the client thread executing the statement.
Return values
falsesuccess
truefailure

◆ unregister_replica()

void unregister_replica ( THD thd,
bool  only_mine,
bool  need_lock_slave_list 
)

Variable Documentation

◆ max_binlog_dump_events

int max_binlog_dump_events
extern

◆ opt_show_replica_auth_info

bool opt_show_replica_auth_info
extern

◆ opt_sporadic_binlog_dump_fail

bool opt_sporadic_binlog_dump_fail
extern