MySQL 9.1.0
Source Code Documentation
semisync_replica_plugin.cc File Reference
#include <assert.h>
#include <mysql.h>
#include <mysqld_error.h>
#include <stdlib.h>
#include <sys/types.h>
#include "my_inttypes.h"
#include "my_macros.h"
#include "plugin/semisync/semisync_replica.h"
#include "sql/current_thd.h"
#include "sql/derror.h"
#include "sql/raii/sentry.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"

Macros

#define SEMI_SYNC_PLUGIN_NAME   "rpl_semi_sync_replica"
 
#define OTHER_SEMI_SYNC_PLUGIN_NAME   "rpl_semi_sync_slave"
 
#define STATUS_VAR_PREFIX   "Rpl_semi_sync_replica_"
 

Functions

static int repl_semi_apply_slave (Binlog_relay_IO_param *, Trans_param *, int &)
 
static int repl_semi_reset_slave (Binlog_relay_IO_param *)
 
static int has_source_semisync (MYSQL *mysql, std::string name)
 Send a query to source server to determine if it supports semisync. More...
 
static int repl_semi_slave_request_dump (Binlog_relay_IO_param *param, uint32)
 
static int repl_semi_slave_read_event (Binlog_relay_IO_param *, const char *packet, unsigned long len, const char **event_buf, unsigned long *event_len)
 
static int repl_semi_slave_queue_event (Binlog_relay_IO_param *param, const char *, unsigned long, uint32)
 
static int repl_semi_slave_io_start (Binlog_relay_IO_param *param)
 
static int repl_semi_slave_io_end (Binlog_relay_IO_param *param)
 
int repl_semi_slave_sql_start (Binlog_relay_IO_param *)
 
static int repl_semi_slave_sql_stop (Binlog_relay_IO_param *, bool)
 
static void fix_rpl_semi_sync_replica_enabled (MYSQL_THD, SYS_VAR *, void *ptr, const void *val)
 
static void fix_rpl_semi_sync_trace_level (MYSQL_THD, SYS_VAR *, void *ptr, const void *val)
 
static MYSQL_SYSVAR_BOOL (enabled, rpl_semi_sync_replica_enabled, PLUGIN_VAR_OPCMDARG, "Enable semi-synchronous replication on this replica (disabled by " "default). ", nullptr, &fix_rpl_semi_sync_replica_enabled, 0)
 
static MYSQL_SYSVAR_ULONG (trace_level, rpl_semi_sync_replica_trace_level, PLUGIN_VAR_OPCMDARG, "The tracing level for semi-sync replication.", nullptr, &fix_rpl_semi_sync_trace_level, 32, 0, ~0UL, 1)
 
static bool is_other_semi_sync_replica_plugin_installed ()
 Return true if this is the new library and the old library is installed, or vice versa. More...
 
static int semi_sync_slave_plugin_init (void *p)
 
static int semi_sync_replica_plugin_check_uninstall (void *)
 
static int semi_sync_slave_plugin_deinit (void *p)
 
 mysql_declare_plugin (semi_sync_slave)
 

Variables

ReplSemiSyncSlaverepl_semisync = nullptr
 
bool semi_sync_need_reply = false
 
static const mysql_service_registry_treg_srv = nullptr
 
const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
static SYS_VARsemi_sync_slave_system_vars []
 
static SHOW_VAR semi_sync_slave_status_vars []
 
Binlog_relay_IO_observer relay_io_observer
 
struct Mysql_replication semi_sync_slave_plugin
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ OTHER_SEMI_SYNC_PLUGIN_NAME

#define OTHER_SEMI_SYNC_PLUGIN_NAME   "rpl_semi_sync_slave"

◆ SEMI_SYNC_PLUGIN_NAME

#define SEMI_SYNC_PLUGIN_NAME   "rpl_semi_sync_replica"

◆ STATUS_VAR_PREFIX

#define STATUS_VAR_PREFIX   "Rpl_semi_sync_replica_"

Function Documentation

◆ fix_rpl_semi_sync_replica_enabled()

static void fix_rpl_semi_sync_replica_enabled ( MYSQL_THD  ,
SYS_VAR ,
void *  ptr,
const void *  val 
)
static

◆ fix_rpl_semi_sync_trace_level()

static void fix_rpl_semi_sync_trace_level ( MYSQL_THD  ,
SYS_VAR ,
void *  ptr,
const void *  val 
)
static

◆ has_source_semisync()

static int has_source_semisync ( MYSQL mysql,
std::string  name 
)
static

Send a query to source server to determine if it supports semisync.

This checks if rpl_semi_sync_source_enabled or rpl_semi_sync_master_enabled is defined on the source.

Parameters
mysqlExisting connection to the source server.
nameThe name to use for the "source" part of the variable name in this check: either "source" or "master".
Return values
1Source supports semisync.
0Source does not support semisync.
-1Error occurred while checking if source supports semisync. This function reports an error to the log in this case.

◆ is_other_semi_sync_replica_plugin_installed()

static bool is_other_semi_sync_replica_plugin_installed ( )
static

Return true if this is the new library and the old library is installed, or vice versa.

Return values
trueThis is semisync_master, and semisync_source is installed already, or this is semisync_source, and semisync_master is installed already.
falseOtherwise

◆ mysql_declare_plugin()

mysql_declare_plugin ( semi_sync_slave  )

◆ MYSQL_SYSVAR_BOOL()

static MYSQL_SYSVAR_BOOL ( enabled  ,
rpl_semi_sync_replica_enabled  ,
PLUGIN_VAR_OPCMDARG  ,
"Enable semi-synchronous replication on this replica (disabled by " "default). "  ,
nullptr  ,
fix_rpl_semi_sync_replica_enabled,
 
)
static

◆ MYSQL_SYSVAR_ULONG()

static MYSQL_SYSVAR_ULONG ( trace_level  ,
rpl_semi_sync_replica_trace_level  ,
PLUGIN_VAR_OPCMDARG  ,
"The tracing level for semi-sync replication."  ,
nullptr  ,
fix_rpl_semi_sync_trace_level,
32  ,
,
0UL,
 
)
static

◆ repl_semi_apply_slave()

static int repl_semi_apply_slave ( Binlog_relay_IO_param ,
Trans_param ,
int &   
)
static

◆ repl_semi_reset_slave()

static int repl_semi_reset_slave ( Binlog_relay_IO_param )
static

◆ repl_semi_slave_io_end()

static int repl_semi_slave_io_end ( Binlog_relay_IO_param param)
static

◆ repl_semi_slave_io_start()

static int repl_semi_slave_io_start ( Binlog_relay_IO_param param)
static

◆ repl_semi_slave_queue_event()

static int repl_semi_slave_queue_event ( Binlog_relay_IO_param param,
const char *  ,
unsigned long  ,
uint32   
)
static

◆ repl_semi_slave_read_event()

static int repl_semi_slave_read_event ( Binlog_relay_IO_param ,
const char *  packet,
unsigned long  len,
const char **  event_buf,
unsigned long *  event_len 
)
static

◆ repl_semi_slave_request_dump()

static int repl_semi_slave_request_dump ( Binlog_relay_IO_param param,
uint32   
)
static

◆ repl_semi_slave_sql_start()

int repl_semi_slave_sql_start ( Binlog_relay_IO_param )

◆ repl_semi_slave_sql_stop()

static int repl_semi_slave_sql_stop ( Binlog_relay_IO_param ,
bool   
)
static

◆ semi_sync_replica_plugin_check_uninstall()

static int semi_sync_replica_plugin_check_uninstall ( void *  )
static

◆ semi_sync_slave_plugin_deinit()

static int semi_sync_slave_plugin_deinit ( void *  p)
static

◆ semi_sync_slave_plugin_init()

static int semi_sync_slave_plugin_init ( void *  p)
static

Variable Documentation

◆ log_bi

accessor built-ins

accessor built-ins

◆ log_bs

string built-ins

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static

◆ relay_io_observer

Binlog_relay_IO_observer relay_io_observer
Initial value:
= {
}
struct Binlog_relay_IO_observer Binlog_relay_IO_observer
Observes and extends the service of slave IO thread.
static int repl_semi_apply_slave(Binlog_relay_IO_param *, Trans_param *, int &)
Definition: semisync_replica_plugin.cc:66
static int repl_semi_slave_read_event(Binlog_relay_IO_param *, const char *packet, unsigned long len, const char **event_buf, unsigned long *event_len)
Definition: semisync_replica_plugin.cc:149
int repl_semi_slave_sql_start(Binlog_relay_IO_param *)
Definition: semisync_replica_plugin.cc:183
static int repl_semi_slave_request_dump(Binlog_relay_IO_param *param, uint32)
Definition: semisync_replica_plugin.cc:117
static int repl_semi_slave_queue_event(Binlog_relay_IO_param *param, const char *, unsigned long, uint32)
Definition: semisync_replica_plugin.cc:161
static int repl_semi_slave_io_start(Binlog_relay_IO_param *param)
Definition: semisync_replica_plugin.cc:175
static int repl_semi_reset_slave(Binlog_relay_IO_param *)
Definition: semisync_replica_plugin.cc:72
static int repl_semi_slave_sql_stop(Binlog_relay_IO_param *, bool)
Definition: semisync_replica_plugin.cc:185
static int repl_semi_slave_io_end(Binlog_relay_IO_param *param)
Definition: semisync_replica_plugin.cc:179

◆ repl_semisync

ReplSemiSyncSlave* repl_semisync = nullptr

◆ semi_sync_need_reply

bool semi_sync_need_reply = false

◆ semi_sync_slave_plugin

struct Mysql_replication semi_sync_slave_plugin
Initial value:
= {
#define MYSQL_REPLICATION_INTERFACE_VERSION
Definition: plugin.h:721

◆ semi_sync_slave_status_vars

SHOW_VAR semi_sync_slave_status_vars[]
static
Initial value:
= {
{nullptr, nullptr, SHOW_BOOL, SHOW_SCOPE_GLOBAL},
}
char rpl_semi_sync_replica_status
Definition: semisync_replica.cc:37
#define STATUS_VAR_PREFIX
Definition: semisync_replica_plugin.cc:48
@ SHOW_BOOL
Definition: status_var.h:32
@ SHOW_SCOPE_GLOBAL
Definition: status_var.h:70

◆ semi_sync_slave_system_vars

SYS_VAR* semi_sync_slave_system_vars[]
static
Initial value:
= {
MYSQL_SYSVAR(trace_level),
nullptr,
}
#define MYSQL_SYSVAR(name)
Definition: plugin.h:255
required bool enabled
Definition: replication_group_member_actions.proto:33