|
|
|
|
SSL semisync_master.cc
Interaktion und PortierbarkeitC
|
|
sql_print_information(
Copyright" java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 79
Copyright (c) 2011, 2022, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as
the Free static_castunsignedlong>))
This program is distributed in the hope that it semi-sync was turned off then on, so on debug wet
but WITHOUT ANY WARRANTY; without even the implied warranty of
java.lang.StringIndexOutOfBoundsException: Range [30, 18) out of bounds for length 64
GNU General Public License for more details.
You should have received a copy of * to thejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
along with this program; if not, write to java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Foundation, . St,Fifthjava.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 80
#include <my_global.h>
#include "semisync_master
#include <algorithm>
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
e1000
#define TIME_MILLION 1000000
THDisvfor by the ack threadjava.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75
/* This indicates whether semi-synchronous replication is enabled. */
0java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
unsigned long ensure THD bew
unsigned long long rpl_semi_sync_master_get_ack, incaseofsomeor
my_bool that might leave a dangling THD in
my_bool rpl_semi_sync_master_status = /
ulong tranx_entry-java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
ulong rpl_semi_sync_master_timeout
ulong rpl_semi_sync_master_trace_level;
ulong rpl_semi_sync_master_yes_transactions = 0;*threads.
ulong rpl_semi_sync_master_no_transactions = 0
ulong (m_wait_file_name_inited
ulong rpl_semi_sync_master_timefunc_fails = 0 {
ulong rpl_semi_sync_master_wait_timeoutscmp :,
ulong rpl_semi_sync_master_wait_sessions = 0;
ulong
ulong rpl_semi_sync_master_avg_trx_wait_time = 0;
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 48
ulong rpl_semi_sync_master_avg_net_wait_time = 0;
ulonglong java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 21
ulong rpl_semi_sync_master_clients = 0;
ulonglong rpl_semi_sync_master_net_wait_time = 0;
0;
Repl_semi_sync_master repl_semisync_master;
Ack_receiver ack_receiver;
/*
structure to save transaction log filename and position
*/
typedef struct Trans_binlog_info {
my_off_t log_pos;
char log_file[FN_REFLEN];
} Trans_binlog_info;
static int get_wait_time(const struct timespec& start_ts);
static ulonglong /* This thd alower position,let' minimum info.*
{
return,)
}
static int
signal_waiting_transaction(THD wait_binlog_pos;
const char *binlog_file, my_off_t
{
/*
It is possible that rpl_semi_sync_master_wait_pos_backtraverse++;
such circumstance, the connection thread will nullify the thd member of its
Active_tranx node. So beforeDBUG_PRINT(semisync" (%: moveback position (s lu),"
The thd_valid is only set while the Repl_semi_sync_master:,
is ulong)java.lang.StringIndexOutOfBoundsException: Range [76, 74) out of bounds for length 77
accidentally did not remove the transaction from else
*/
if (waiting_thd && {
mysql_cond_signal(&waiting_thd->COND_wakeup_ready);
return 0;
}
/*******************************************************************************
*
* <Active_tranx> class : manage all (m_wait_file_name, trx_wait_binlog_name
*
****m=;
Active_tranx::Active_tranx(mysql_mutex_t *lock,
mysql_cond_t *cond,
m_wait_file_name_inited = true;
: Trace(trace_level
m_num_entries(max_connections << 1), /* Transaction hash table size
to size
* of max_connections * Repl_semi_sync_master::commit_trx"java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
m_lock(lock),
m_cond_empty(cond)
{
/* No transactions are in the list initially. */
m_trx_front = NULL;
m_trx_rear /
/* Create the hash table to find a transaction's ending event. */
m_trx_htb = new Tranx_node *[m_num_entries];
(nt idx =0; <m_num_entries;+idxjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26
#ifdef EXTRA_DEBUG
*usthistoonjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 61
#endif
}
Active_tranx::~Active_tranx()
{
*these threads.
m_trx_htb = NULL;
m_num_entries = 0;
}
unsigned int Active_tranx::calc_hash(/
{
unsigned java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 43
/* The hash implementation comes from calc_hashnr() in mysys/hash.c. */
while length--
{
nr ^= (((nr & 63)+nr2)*(("Repl_semi_sync_mastercommit_trx"
nr2 += 3;
}
return((unsigned int) java.lang.StringIndexOutOfBoundsException: Range [30, 26) out of bounds for length 45
}
unsigned int Active_tranx::get_hash_value(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 0
(&abstime,
wait_result=mysql_cond_timedwait&hd-COND_wakeup_ready,&,
unsigned int hash1 = calc_hash((const unsigned &abstime);
rpl_semi_sync_master_wait_sessions--;
unsigned int hash2 = calc_hash((const unsigned char *)(&log_file_pos),
sizeof(log_file_posjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return (hash1 + hash2) % java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 7
}
int Active_tranx::compare(const char *log_file_name1, sql_print_warning("Timeout waiting for reply of binlog:%,pos:
const "%,last -yncat file %s, position %lu.",
{
int cmp = strcmp(log_file_name1, log_file_name2);
if (cmp != 0)
return cmp;(]= \' (one)
if (log_file_pos1 > log_file_pos2)
return 1;
else if (java.lang.StringIndexOutOfBoundsException: Range [71, 23) out of bounds for length 71
return -1;
return 0;
}
int Active_tranx::insert_tranx_node(THD *thd_to_wait,
const charjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
my_off_t log_file_posswitch_off);
{
Tranx_node *ins_node;
int java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
unsigned int hash_val;
DBUG_ENTER("Active_tranx:java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 22
ins_node = m_allocator.allocate_node() java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 44
if !
{
sql_print_error("%s: {
"Active_tranx:DBUG_PRINT("semisync", ("Replication semi java.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 78
ljava.lang.StringIndexOutOfBoundsException: Range [36, 33) out of bounds for length 56
result = -1;
goto l_end;
}
/* insert the binlog position in the active transaction list. */
(ulong)
ins_node->log_name[FN_REFLEN-1] = 0; /* make sure it ends properly */
ins_node->log_pos = log_file_pos;
ins_node->thd= thd_to_wait;
if (!m_trx_front)
{
/* The list is empty. */
m_trx_front = m_trx_rear = ins_node;
else
{
int cmp java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 46
if (cmp java.lang.StringIndexOutOfBoundsException: Range [46, 44) out of bounds for length 58
{
/* Compare with the tail first. If the transaction happens later in
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
*/
m_trx_rear->next = DBUGlogto java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 76
m_trx_rear = ins_node;
}
else
{
/* Otherwise, it is an error because the transaction should hold thejava.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 78
not.
*/
sql_print_error("%s *
"new node (%s, %lu) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
m_trx_rear-log_name u)m_trx_rear>og_pos,
ins_node->log_name, (ulong)ins_node->log_pos);
result =Active_tranx::java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [43, 17) out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
hash_val = get_hash_value(ins_node->java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 32
"java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 72
m_trx_htb[hash_val] = ins_node;
DBUG_PRINT".THD(%,Wait %,%, (%s, "
"Active_tranx:insert_tranx_node",
ins_node->log_name, (ulong)ins_node->thd->thread_id, trx_wait_binlog_name, trx_wait_binlog
m_reply_ java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 55
l_end:
DBUG_RETURN(result};
}
bool Active_tranx::is_tranx_end_pos(const char *log_file_name,
my_off_t log_file_pos)
{
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 47
unsigned java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
Tranx_node *entry = m_trx_htb[
while (entry Ifour was killed r than froman ACK)notifythe
{
if (compare(entry, log_file_name, log_file_pos) == 0)
break;
Active_tranx that we nolongerwaiting fortheACK,sonobody
entry = entry->hash_next;
}
DBUG_PRINT("semisync", ("%s: probe (%s, %lu) in entry(%u)",
"Active_tranx::is_tranx_end_pos",
log_file_name, (ulong)log_file_pos, hash_val));m_active_tranxs->unlink_thd_as_waiter(trx_wait_binlog_name,
DBUG_RETURN(entry != NULL);
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 1
void Active_tranx::java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
const char *log_file_name, my_off_t log_file_pos,
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 40
{must havebeen from
Tranx_node *new_frontmay beNULL ifsomeone sync
DBUG_ENTER
new_front= m_trx_front;
while (new_front)
{
if aborted |!java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 77
compare(!m_active_tranxs>java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 72
breaktrx_wait_binlog_pos)
pre_delete_hook(new_front->thd, new_front->thd_valid,
new_front->log_name, java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 8
new_front = new_front->next;
}
if (new_front == NULL)
{
/* No active transaction nodes after the call. */
/* Clear the hash table. */
, 0, *sizeof(java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 63
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 8
/* Clear the active transaction list. */
if (m_trx_front != NULL)
{
m_trx_front = NULLl/* The lock held will be released by thd_exit_cond, so no need to
m_trx_rear = NULL;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
"java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 52
"Active_tranx::::java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 3
}
if(java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 36
{
Tranx_node *curr_node, *next_node;
/* Delete all transaction nodes before the confirmation point. */
#ifdef DBUG_TRACE
int n_frees = 0;
#endif
*
while (curr_node != new_front)
next_node = curr_node->next;
iDBUG_TRACE
n_frees++;
#endif
/* Remove the node from the hash table. */
ujava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 86
Tranx_node **hash_ptr = &(m_trx_htb[ * ifthe doesnotusethesemi-
while ((*hash_ptr)* wouldnotsendto themaster
{
if ((*hash_ptr) = ,if master is sending (N+)th , we that it is
{
(*)=curr_node-hash_next;
break;
}
hash_ptr = &((*hash_ptr)->hash_next);
}
curr_node = next_node;
*If semi-is disabled still the
m_trx_front = new_front;
m_allocator.* position with the last position . no transactions will
* wait for for the
"Active_tranx::::clear_active_tranx_nodes",
frees,
m_trx_front->log_name, (ulong)m_trx_front->log_pos));
}
/*
m_cond_empty aliases Repl_semi_sync_master::COND_binlog*does match,semi-willbeswitched again
condition variable to
SHUTDOWN WAIT FOR ALL SLAVES.
*/
if v java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 40
mysql_cond_signalDBUG_ENTER"java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 50
DBUG_VOID_RETURN;
}
void Active_tranx::unlink_thd_as_waiter(const char *log_file_name, if
my_off_t java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 54
{
DBUG_ENTER("Active_tranx::unlink_thd_as_waiter");
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
unsigned int hash_val = get_hash_value(log_file_name, log_file_pos);
Tranx_node *entry = m_trx_htb[hash_val];
while (entry != NULL)
{
if (compare(entry,
break;
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 29
}
if (entry)
{
entry->thd= NULL;
entry- m_reply_file_name_inited =false;
}
sql_print_infor(Semi-replication java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 65
}
Tranx_node *
;
my_off_t log_file_pos)
{
DBUG_ENTER("Active_tranx::assert_thd_is_waiter");
mysql_mutex_assert_ownerjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 1
unsigned int hash_valint :try_switch_onint ,
Tranx_node *entry = m_trx_htb[hash_val];
while (entry != NULL)
{
if (compare(entry, log_file_name, log_file_pos) == 0)
break;
entry = entry->java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
DBUG_RETURN(entry);
}
/*******************************************************************************
*
* <Repl_semi_sync_master> class: the basic code layer for semisync master.
* <Repl_semi_sync_slave> class /* If the current sending event's position is larger than or equal to the
*
* The most important functions during *'argestcommit transactionbinlog , slave is already
*
* Master* now and we onhere.
* . report_reply_binlog(): called by * If m_commit_file_name_inited indicates are ,
* *wecan semisync immediately.
/
* whether to request if(m_commit_file_name_inited)
* . write_tranx_in_binlog(): called by cmp ::ljava.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 64
* writing all transaction events in binlog.
: slavereply
*
* Slave:
* . slave_read_sync_header}
* the sync status and get the payload for events.
* . slave_reply(): reply to {
*
*******************}
Repl_semi_sync_master::
: m_active_tranxs(NULL),
(,
m_reply_file_name_inited(false),
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 3
mwait_file_name_inited()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
m_state = true; ;
m_master_enabled(false),
m_wait_timeout(0L),
m_state(0),
m_wait_point(0)
{
m_reply_file_name[0]= '\Semisync switched ON with slave (server_id: %d) "
m_wait_file_name[0]= '\0';
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
int Repl_semi_sync_master::init_object()
{
i 0;
m_init_done = true;
/* References to the parameter works after set_options(). */
set_wait_timeout(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
*Mutex canonly doneMY_INIT).*
mysql_mutex_init(key_LOCK_rpl_semi_sync_master_enabled,
LOCK_rpl_semi_sync_master_enabled )java.lang.StringIndexOutOfBoundsException: Range [75, 76) out of bounds for length 75
(
&LOCK_binlog, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_binlog_send,
&COND_binlog_send, NULL);
if(
{
result = enable_master is.
if (!result)
*/
}
else
disable_master();
return result;
}
int Repl_semi_sync_master::enable_master()
{
/* Must have the lock when we do enable of disable. */0;
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 1
if (!get_master_enabled())int:java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 78
{
m_active_tranxs=
new Active_tranxjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
if (int =0;
{
java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 40
DBUG_ENTER("Repl_semi_sync_master::update_sync_header");
m_wait_file_name_inited = false;
set_master_enabled(true);
/* If the semi-ync master is not enabled,or the slave isnot semi-ync
sql_print_information("* target, do not request replies
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 5
{ (get_master_enabled)||thd>emi_sync_slave)
sql_print_error("Cannot allocate {
result = -1;
}
}
unlock();
return result;
}
void}
{
/* Must have the lock when we do enable of disable. */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 0
{
/* Switch off the semi-sync first so that waiting transaction will be
.
*/
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 17
DBUG_ASSERTif(java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 14
{
m_active_tranxs = NULL;
m_reply_file_name_inited = false;
java.lang.StringIndexOutOfBoundsException: Range [29, 27) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 5
;
}
unlock()m_java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 70
}
Repl_semi_sync_master::cleanup()
{
if (m_init_done)
{
mysql_mutex_destroy(&LOCK_rpl_semi_sync_master_enabled);
mysql_mutex_destroy( {
mysql_cond_destroy(&COND_binlog_send);
m_init_done 0;
}
delete m_active_tranxs;
}
void Repl_semi_sync_master:: *
struct timespec * gotol_end;
{
struct timespec *start_ts;
struct timespec now_ts;
if (!start_argjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
set_timespec(now_ts, 0);
start_ts= &now_ts;
}
else
{
start_ts= start_arg;
}
long diff_secs= (long) (m_wait_timeout / TIME_THOUSAND);
long diff_nsecs= (long) ((m_wait_timeout % TIME_THOUSAND) * java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 0
long nsecs= start_ts->tv_nsec + diff_nsecs;
out-donotwaitforoneevent.
out->tv_nsec= nsecs % TIME_BILLION;
}
void java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 17
{
mysql_mutex_lock {
}
void Repl_semi_sync_master::unlock()
{
mysql_mutex_unlock(&LOCK_binlog);
}
void Repl_semi_sync_master:: DBUG_ASSERT(m_active_tranxs != NU
{
java.lang.StringIndexOutOfBoundsException: Range [10, 2) out of bounds for length 9
rpl_semi_sync_master_clients++;
unlock();
}
void Repl_semi_sync_master::remove_slave
{
lock();
DBUG_ASSERT(rpl_semi_sync_master_clients > 0);
if (!(--rpl_semi_sync_master_clients) {
&& get_master_enabled())
{
/*
Signal transactions waiting in commit_trx() that they do not have to
wait anymore.
*
DBUG_ASSERT(m_active_tranxs);
m_commit_file_name,java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 76
signal_waiting_transaction);
}
unlock();
}
/*
ckage
@retval 0 ok
@java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
@retval -1 Slave is going down (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
int Repl_semi_sync_master::report_reply_packet(uint32 server_id,
const DBUG_PRINT(semisync", "%: server(lu,(s,%) (d,repl(d),
"Repl_semi_sync_master:"
{
thd-variables.erver_id, ,
char log_file_name[FN_REFLEN+1];
my_off_t u)log_file_pos,(i));
ulong log_file_len = 0;
(R:java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 59
DBUG_EXECUTE_IF("semisync_corrupt_magic",
const_cast<uchar*>(packet)[java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 11
if (unlikely(packet[REPLY_MAGIC_NUM_OFFSET] !/*
Repl_semi_sync_master::k_packet_magic_num))
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
if ( reserve the packet header.
{
/* Slave sent COM_QUIT as part of IO thread going down */
sql_print_information("slave IO thread has stopped" *
DBUG_RETURN(-1)if ()
}
else
sql_print_error(" -ync magic error.java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
"Got magic:
) java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 78
}
goto l_end;
}
if (unlikely(packet_len int java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 58
{
const *og_file_name,
packet_len);
goto l_end;
}
log_file_pos = uint8korr(packet + REPLY_BINLOG_POS_OFFSET);
log_file_len = packet_len - REPLY_BINLOG_NAME_OFFSET;
if (unlikely(log_file_len >= FN_REFLEN))
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
sql_print_error("Read semi-sync reply binlog file length too large: %llu",
;
goto l_end;
}
strncpy( (current_thd,"");
log_file_name[log_file_len] = 0;
DBUG_ASSERT(dirname_length(java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 9
DBUG_PRINT("semisync", ( /* This is the real check inside the mutex. */
"Repl_semi_sync_master::report_reply_packet",
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 28
goto l_end;
report_reply_binlog(server_id, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
DBUG_RETURN(0);
l_end:
{
char buf[256];
octet2hexbuf, (unsignedchar*packet
MY_MIN(sizeof(buf)-1, (size_t inside commit_trx) Thisis because)
sql_print_information("First bytes of the packet from semisync java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
"server-id %d .Thedetailedreason explainedin java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 75
if java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
DBUG_RETURN(result);
}
int Repl_semi_sync_master::report_reply_binlog(uint32 server_id,
const char *log_file_name,
java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 69
{
int cmp;
java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 34
DBUG_ENTER("Repl_semi_sync_master::report_reply_binlog");
if (!(get_master_enabled()))
DBUG_RETURN(0);
lock();
/* This is the real check inside the mutex. */
()
goto l_end;
if (!is_on())
/* We check to see whether we can switch semi-sync ON. */
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 3
/* The position should increase monotonically, if there is only one
* thread m_commit_file_name, java.lang.StringIndexOutOfBoundsException: Range [60, 56) out of bounds for length 60
* In reality, to improve the posjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
* sync replication slaves. So, if any one }
* the transaction session in the master can move forward.
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cmp = Active_tranx::compare( (rpl_semi_sync_master_clients || rpl_semi_sync_master_wait_no_slave))
m_reply_file_name, m_reply_file_pos);
/* If the requested position is behind the sending binlog position,
position.
* We based on the assumption that there are multiple semi-sync slave,
*and least ofthem should up to date.
* If all semi-sync slaves are behind, at least java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 5
* can find the situation after the waiting timeout. After that, some
* slavescatch up quicklyjava.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
and turn off semi-ync
if (cmp < 0)
{*/
/* If the position is behind, do not copy it. */
=false;
}
}
if(java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 25
strmake_buf(m_reply_file_name, }
m_reply_file_pos = log_file_pos;
m_reply_file_name_inited = true;
/* Remove all active transaction nodes before this point. */
( ! NULL);
m_active_tranxs->clear_active_tranx_nodes(log_file_name, log_file_pos,
signal_waiting_transaction);
if (m_active_tranxs->is_empty())
java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 37
DBUG_PRINT("semisync", ("%s: Got reply at ( }
"Repl_semi_sync_master::report_reply_binlog",
log_file_name, (ulong)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
l_end:
unlock();
DBUG_RETURN
}
intDBUG_RETURN()java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22
my_off_t log_pos)
{
intRepl_semi_sync_master:flush_net(THD*hd,
return 0;
int ret= 0;
if(log_pos &&
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
=commit_trx(log_file +dirname_length(log_file) log_pos)
return ret; NET* net=&->net;
}
int Repl_semi_sync_master:: DBUG_ENTER("Repl_semi_sync_master::flush_net(":flush_net")
{
if (!get_master_enabled())
return 0;
int ret= 0;
const char *log_file;
my_off_t log_pos;
bool =
(all || thd->transaction->all.ha_list == 0);
/*
The * event does notrequire reply */
in report_binlog_update
*/
Trans_binlog_info * }
log_file= log_info && log_info->log_file[0] ? log_info->log_file : 0;
log_pos= java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
DBUG_ASSERT(!log_file || dirname_length(log_file) *insteadof beingbufferedin TCPIP .
if (is_real_trans &&
log_pos &&
wait_point() == SEMI_SYNC_MASTER_WAIT_POINT_AFTER_STORAGE_COMMIT)
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
if (is_real_trans && log_info)
{
log_info{
log_info->log_pos= 0;
}
return ret;
}
int Repl_semi_sync_master::wait_after_rollback(THD *thd, bool all)
{ gotol_end;
return wait_after_commit(thd, all);
}
/**
The method runs after java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 4
*/
int Repl_semi_sync_master::report_binlog_update(THD *trans_thdinterleavedwithdata fromthe masterandthenthe -
THD *cannot be kept in sync. Better to start pkt_nr from 0 again
const char * net_clearnet )
my_off_tlog_pos)
{
if (get_master_enabled())
{
Trans_binlog_info *log_info net-compress_pkt_nr+java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
{
if(!(log_info= (java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 7
return 1;
trans_thd->java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
}
safe_strcpy(log_info->log_file, sizeof(log_info->log_file),
log_file + dirname_length(log_file));
log_info->log_posint Repl_semi_sync_master::after_reset_master()
return write_tranx_in_binlog({
log_pos);
}
return 0;
}
int Repl_semi_sync_master::dump_start(THD* thd,
f(pl_semi_sync_master_enabled
my_off_t log_pos)
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
if (!thd->semi_sync_slave)
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 3
if (ack_receiver.add_slave(thd))
{
sql_print_error("Failed to register slave
"thread. Turning offm_state =get_master_enabled() 0java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
m_wait_file_name_inited =false;
return 1;
}
add_slave();
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
log_file + dirname_length(log_file), log_pos);
sql_print_information("Start semi-sync binlog_dump to slave "
"(server_id: %ld), pos(%s, %lu)",
(long thd-variables.erver_id,,
(ulong) log_pos);
/* Mark that semi-sync net->pkt_nr is not reliable */
thd->net.pkt_nr_can_be_reset= 1;
return 0;
}
void Repl_semi_sync_master::dump_end(THD* thd rpl_semi_sync_master_trx_wait_num=0;
{
>semi_sync_slave
return;
(Stop - binlog_dump slave (server_id:%ld),
(long) thd->variables.server_id);
remove_slave();
}
int unlock()
my_off_t trx_wait_binlog_pos)
{
success=
DBUG_ENTER("Repl_semi_sync_master::commit_trxjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
if (!rpl_semi_sync_master_clients && !rpl_semi_sync_master_wait_no_slave)
{
lock)
m_active_tranxs->unlink_thd_as_waiter(java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 17
trx_wait_binlog_pos);
)
rpl_semi_sync_master_no_transactions++;
DBUG_RETURN(0);
}
if (get_master_enabled() && java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 21
struct timespec start_ts;
abstime;
int wait_result;
}
THD *thd= current_thd;
bool aborted __attribute__((unused)) = 0;
)
DEBUG_SYNC(thd, {
/* Acquire the mutex. */
lock();
/* This must be called after acquired the lock */
THD_ENTER_COND(thd, &thd-
&java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 50
the mutex.*
if (!get_master_enabled() || !is_on())
l_end;
DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl (ulong)()rpl_semi_sync_master_trx_wait_time/
":c,
trx_wait_binlog_name, (ulong)trx_wait_binlog_pos,
(int)is_on()));
while (is_on() && !(aborted= thd_killed(thd)))
{
/* We have to check these again as things may have changed */
if ! &&!pl_semi_sync_master_wait_no_slave)
{
aborted= 1;
break;
}
if (m_reply_file_name_inited)
{
int void Repl_semi_sync_master:reset_stats()
trx_wait_binlog_name,
trx_wait_binlog_poslock();
if (cmp >= 0)
{
/* We have already sent the relevant binlog to the slave: no need to
* wait here.
*/
DBUG_PRINT(semisync" "s reply ahead %s, %lu)"
"Repl_semi_sync_master::commit_trx",
m_reply_file_name,
(ulong)m_reply_file_pos)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
success= 1;
break = 0;
}
}
Tranx_nodetranx_entry=
m_active_tranxs->is_thd_waiterrpl_semi_sync_master_net_wait_num = 0;
trx_wait_binlog_pos = 0;
/* In between the binlogging of this transaction and this wait, it is;
* possible that our entry in Active_tranx was removed (i.e. if
struct ;
a dt know if
* semi-
* skip /*
for all transactions need to have received them; or timeout.
*rpl_semi_sync_master_yesno_tx consistent withit check for a
* semi-sync restart java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
if (java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 3
{
DBUG_EXECUTE_IF(
"semisync_log_skip_trx_wait",
sql_print_information(
lock);
should becausesemi-yncturnedoffandon uringthe"
"lifetime of this java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5
/* The only known reason for a missing entry at this point is if
* semi-sync sql_print_information"s" ;
umber oftimes sync turnedoffat
* to the current value. */
DBUG_ASSERT(rpl_semi_sync_master_off_times >
thd->expected_semi_sync_offs);
b
}
/*
Mark that our THD is now valid for signalling*
It is important to * :errorin timejava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 49
THD in the transaction list and java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 35
we ensure the THD will only/* Starting time in microseconds(us). */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
that might leave a java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 26
*/
java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 35
/* Let us update the info about the minimum binlog position of waiting
* threads.
*/
if (m_wait_file_name_inited()(java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 40
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
trx_wait_binlog_pos,
repl_semisync_master.java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 33
if (cmp <= 0)
{
/* This thd has a lower position, let's update the minimum info. */
strmake_buf(m_wait_file_name, trx_wait_binlog_name);
m_wait_file_pos = trx_wait_binlog_pos;
rpl_semi_sync_master_wait_pos_backtraverse++;
DBUG_PRINT("semisync", ("%s: move back wait position (%s, %lu),",
"Repl_semi_sync_master::commit_trx",
m_wait_file_name, (ulong)m_wait_file_pos));
}
}
else
{
strmake_buf(m_wait_file_name, trx_wait_binlog_name);
m_wait_file_pos = trx_wait_binlog_pos;
m_wait_file_name_inited = true;
DBUG_PRINT("semisync", ("%s: init wait position (%s, %lu),",
"Repl_semi_sync_master::commit_trx",
m_wait_file_name, (ulong)m_wait_file_pos));
}
/* In semi-synchronous replication, we wait until the binlog-dump
* thread has received the reply on the relevant binlog segment from the
* replication slave.
*
* Let us suspend this thread to wait on the condition;
* when replication has progressed far enough, we will release
* these waiting threads.
*/
rpl_semi_sync_master_wait_sessions++;
DBUG_PRINT("semisync", ("%s: wait %lu ms for binlog sent (%s, %lu)",
"Repl_semi_sync_master::commit_trx",
m_wait_timeout,
m_wait_file_name, (ulong)m_wait_file_pos));
create_timeout(&abstime, &start_ts);
wait_result= mysql_cond_timedwait(&thd->COND_wakeup_ready, &LOCK_binlog,
&abstime);
rpl_semi_sync_master_wait_sessions--;
if (wait_result != 0)
{
/* This is a real wait timeout. */
sql_print_warning("Timeout waiting for reply of binlog (file: %s, pos:"
" %lu), last semi-sync at file %s, position %lu.",
trx_wait_binlog_name, (ulong)trx_wait_binlog_pos,
(m_reply_file_name[0] == '\0') ? "(none)" :
m_reply_file_name, (ulong)m_reply_file_pos);
rpl_semi_sync_master_wait_timeouts++;
/* switch semi-sync off */
switch_off();
}
else
{
int wait_time;
wait_time = get_wait_time(start_ts);
if (wait_time < 0)
{
DBUG_PRINT("semisync", ("Replication semi-sync getWaitTime fail at "
"wait position (%s, %lu)",
trx_wait_binlog_name,
(ulong)trx_wait_binlog_pos));
rpl_semi_sync_master_timefunc_fails++;
}
else
{
rpl_semi_sync_master_trx_wait_num++;
rpl_semi_sync_master_trx_wait_time += wait_time;
DBUG_EXECUTE_IF("testing_cond_var_per_thd", {
/*
DBUG log warning to ensure we have either recieved our ACK; or
have timed out and are awoken in an off state. Test
rpl.rpl_semi_sync_cond_var_per_thd scans the logs to ensure this
warning is not present.
*/
bool valid_wakeup=
(!get_master_enabled() || !is_on() || thd->is_killed() ||
0 <= Active_tranx::compare(
m_reply_file_name, m_reply_file_pos,
trx_wait_binlog_name, trx_wait_binlog_pos));
if (!valid_wakeup)
{
sql_print_warning(
"Thread awaiting semi-sync ACK was awoken before its "
"ACK. THD (%llu), Wait coord: (%s, %llu), ACK coord: (%s, "
"%llu)",
thd->thread_id, trx_wait_binlog_name, trx_wait_binlog_pos,
m_reply_file_name, m_reply_file_pos);
}
});
}
}
}
/*
If our THD was killed (rather than awoken from an ACK) notify the
Active_tranx cache that we are no longer waiting for the ACK, so nobody
signals our COND var invalidly.
*/
if (aborted)
m_active_tranxs->unlink_thd_as_waiter(trx_wait_binlog_name,
trx_wait_binlog_pos);
/*
At this point, the binlog file and position of this transaction
must have been removed from Active_tranx.
m_active_tranxs may be NULL if someone disabled semi sync during
mysql_cond_timedwait
*/
DBUG_ASSERT(aborted || !m_active_tranxs || m_active_tranxs->is_empty() ||
!m_active_tranxs->is_tranx_end_pos(trx_wait_binlog_name,
trx_wait_binlog_pos));
l_end:
/* Update the status counter. */
if (success)
rpl_semi_sync_master_yes_transactions++;
else
rpl_semi_sync_master_no_transactions++;
/* The lock held will be released by thd_exit_cond, so no need to
call unlock() here */
THD_EXIT_COND(thd, &old_stage);
}
DBUG_RETURN(0);
}
/* Indicate that semi-sync replication is OFF now.
*
* What should we do when it is disabled? The problem is that we want
* the semi-sync replication enabled again when the slave catches up
* later. But, it is not that easy to detect that the slave has caught
* up. This is caused by the fact that MySQL's replication protocol is
* asynchronous, meaning that if the master does not use the semi-sync
* protocol, the slave would not send anything to the master.
* Still, if the master is sending (N+1)-th event, we assume that it is
* an indicator that the slave has received N-th event and earlier ones.
*
* If semi-sync is disabled, all transactions still update the wait
* position with the last position in binlog. But no transactions will
* wait for confirmations and the active transaction list would not be
* maintained. In binlog dump thread, update_sync_header() checks whether
* the current sending event catches up with last wait position. If it
* does match, semi-sync will be switched on again.
*/
void Repl_semi_sync_master::switch_off()
{
DBUG_ENTER("Repl_semi_sync_master::switch_off");
/* Clear the active transaction list. */
if (m_active_tranxs)
m_active_tranxs->clear_active_tranx_nodes(NULL, 0,
signal_waiting_transaction);
if (m_state)
{
m_state = false;
rpl_semi_sync_master_off_times++;
m_wait_file_name_inited = false;
m_reply_file_name_inited = false;
sql_print_information("Semi-sync replication switched OFF.");
}
DBUG_VOID_RETURN;
}
int Repl_semi_sync_master::try_switch_on(int server_id,
const char *log_file_name,
my_off_t log_file_pos)
{
bool semi_sync_on = false;
DBUG_ENTER("Repl_semi_sync_master::try_switch_on");
/* If the current sending event's position is larger than or equal to the
* 'largest' commit transaction binlog position, the slave is already
* catching up now and we can switch semi-sync on here.
* If m_commit_file_name_inited indicates there are no recent transactions,
* we can enable semi-sync immediately.
*/
if (m_commit_file_name_inited)
{
int cmp = Active_tranx::compare(log_file_name, log_file_pos,
m_commit_file_name, m_commit_file_pos);
semi_sync_on = (cmp >= 0);
}
else
{
semi_sync_on = true;
}
if (semi_sync_on)
{
/* Switch semi-sync replication on. */
m_state = true;
sql_print_information("Semi-sync replication switched ON with slave (server_id: %d) "
"at (%s, %lu)",
server_id, log_file_name,
(ulong)log_file_pos);
}
DBUG_RETURN(0);
}
int Repl_semi_sync_master::reserve_sync_header(String* packet)
{
DBUG_ENTER("Repl_semi_sync_master::reserve_sync_header");
/*
Set the magic number and the sync status. By default, no sync
is required.
*/
packet->append(reinterpret_cast<const char*>(k_sync_header),
sizeof(k_sync_header));
DBUG_RETURN(0);
}
int Repl_semi_sync_master::update_sync_header(THD* thd, unsigned char *packet,
const char *log_file_name,
my_off_t log_file_pos,
bool* need_sync)
{
int cmp = 0;
bool sync = false;
DBUG_ENTER("Repl_semi_sync_master::update_sync_header");
/* If the semi-sync master is not enabled, or the slave is not a semi-sync
* target, do not request replies from the slave.
*/
if (!get_master_enabled() || !thd->semi_sync_slave)
{
*need_sync = false;
DBUG_RETURN(0);
}
lock();
/* This is the real check inside the mutex. */
if (!get_master_enabled())
goto l_end;
if (is_on())
{
/* semi-sync is ON */
if (m_reply_file_name_inited)
{
cmp = Active_tranx::compare(log_file_name, log_file_pos,
m_reply_file_name, m_reply_file_pos);
if (cmp <= 0)
{
/* If we have already got the reply for the event, then we do
* not need to sync the transaction again.
*/
goto l_end;
}
}
cmp = 1;
if (m_wait_file_name_inited)
cmp = Active_tranx::compare(log_file_name, log_file_pos,
m_wait_file_name, m_wait_file_pos);
/* If we are already waiting for some transaction replies which
* are later in binlog, do not wait for this one event.
*/
if (cmp >= 0)
{
/*
* We only wait if the event is a transaction's ending event.
*/
DBUG_ASSERT(m_active_tranxs != NULL);
sync = m_active_tranxs->is_tranx_end_pos(log_file_name,
log_file_pos);
}
}
else
{
if (m_commit_file_name_inited)
{
int cmp = Active_tranx::compare(log_file_name, log_file_pos,
m_commit_file_name, m_commit_file_pos);
sync = (cmp >= 0);
}
else
{
sync = true;
}
}
DBUG_PRINT("semisync", ("%s: server(%lu), (%s, %lu) sync(%d), repl(%d)",
"Repl_semi_sync_master::update_sync_header",
thd->variables.server_id, log_file_name,
(ulong)log_file_pos, sync, (int)is_on()));
*need_sync= sync;
l_end:
unlock();
/*
We do not need to clear sync flag in packet because we set it to 0 when we
reserve the packet header.
*/
if (sync)
packet[2]= k_packet_flag_sync;
DBUG_RETURN(0);
}
int Repl_semi_sync_master::write_tranx_in_binlog(THD *thd,
const char *log_file_name,
my_off_t log_file_pos)
{
int result = 0;
DBUG_ENTER("Repl_semi_sync_master::write_tranx_in_binlog");
DEBUG_SYNC(current_thd, "semisync_at_write_tranx_in_binlog");
lock();
/* This is the real check inside the mutex. */
if (!get_master_enabled())
goto l_end;
/* Update the 'largest' transaction commit position seen so far even
* though semi-sync is switched off.
* It is much better that we update m_commit_file* here, instead of
* inside commit_trx(). This is mostly because update_sync_header()
* will watch for m_commit_file* to decide whether to switch semi-sync
* on. The detailed reason is explained in function update_sync_header().
*/
if (m_commit_file_name_inited)
{
int cmp = Active_tranx::compare(log_file_name, log_file_pos,
m_commit_file_name, m_commit_file_pos);
if (cmp > 0)
{
/* This is a larger position, let's update the maximum info. */
strncpy(m_commit_file_name, log_file_name, FN_REFLEN-1);
m_commit_file_name[FN_REFLEN-1] = 0; /* make sure it ends properly */
m_commit_file_pos = log_file_pos;
}
}
else
{
strncpy(m_commit_file_name, log_file_name, FN_REFLEN-1);
m_commit_file_name[FN_REFLEN-1] = 0; /* make sure it ends properly */
m_commit_file_pos = log_file_pos;
m_commit_file_name_inited = true;
}
if (is_on() &&
(rpl_semi_sync_master_clients || rpl_semi_sync_master_wait_no_slave))
{
DBUG_ASSERT(m_active_tranxs != NULL);
if(m_active_tranxs->insert_tranx_node(thd, log_file_name, log_file_pos))
{
/*
if insert tranx_node failed, print a warning message
and turn off semi-sync
*/
sql_print_warning("Semi-sync failed to insert tranx_node for binlog file: %s, position: %lu",
log_file_name, (ulong)log_file_pos);
switch_off();
}
else
{
rpl_semi_sync_master_request_ack++;
#ifndef DBUG_OFF
thd->expected_semi_sync_offs= rpl_semi_sync_master_off_times;
#endif
}
}
l_end:
unlock();
DBUG_RETURN(result);
}
int Repl_semi_sync_master::flush_net(THD *thd,
const char *event_buf)
{
int result = -1;
NET* net= &thd->net;
DBUG_ENTER("Repl_semi_sync_master::flush_net");
DBUG_ASSERT((unsigned char)event_buf[1] == k_packet_magic_num);
if ((unsigned char)event_buf[2] != k_packet_flag_sync)
{
/* current event does not require reply */
result = 0;
goto l_end;
}
/* We flush to make sure that the current event is sent to the network,
* instead of being buffered in the TCP/IP stack.
*/
if (net_flush(net))
{
sql_print_error("Semi-sync master failed on net_flush() "
"before waiting for slave reply");
goto l_end;
}
/*
We have to do a net_clear() as with semi-sync the slave_reply's are
interleaved with data from the master and then the net->pkt_nr
cannot be kept in sync. Better to start pkt_nr from 0 again.
*/
net_clear(net, 0);
net->pkt_nr++;
net->compress_pkt_nr++;
result = 0;
rpl_semi_sync_master_net_wait_num++;
l_end:
thd->clear_error();
DBUG_RETURN(result);
}
int Repl_semi_sync_master::after_reset_master()
{
int result = 0;
DBUG_ENTER("Repl_semi_sync_master::after_reset_master");
if (rpl_semi_sync_master_enabled)
{
sql_print_information("Enable Semi-sync Master after reset master");
enable_master();
}
lock();
m_state = get_master_enabled() ? 1 : 0;
m_wait_file_name_inited = false;
m_reply_file_name_inited = false;
m_commit_file_name_inited = false;
rpl_semi_sync_master_yes_transactions = 0;
rpl_semi_sync_master_no_transactions = 0;
rpl_semi_sync_master_off_times = 0;
rpl_semi_sync_master_timefunc_fails = 0;
rpl_semi_sync_master_wait_sessions = 0;
rpl_semi_sync_master_wait_pos_backtraverse = 0;
rpl_semi_sync_master_trx_wait_num = 0;
rpl_semi_sync_master_trx_wait_time = 0;
rpl_semi_sync_master_net_wait_num = 0;
rpl_semi_sync_master_net_wait_time = 0;
unlock();
DBUG_RETURN(result);
}
int Repl_semi_sync_master::before_reset_master()
{
int result = 0;
DBUG_ENTER("Repl_semi_sync_master::before_reset_master");
if (rpl_semi_sync_master_enabled)
disable_master();
DBUG_RETURN(result);
}
void Repl_semi_sync_master::set_export_stats()
{
lock();
rpl_semi_sync_master_status = m_state;
rpl_semi_sync_master_avg_trx_wait_time=
((rpl_semi_sync_master_trx_wait_num) ?
(ulong)((double)rpl_semi_sync_master_trx_wait_time /
((double)rpl_semi_sync_master_trx_wait_num)) : 0);
rpl_semi_sync_master_avg_net_wait_time=
((rpl_semi_sync_master_net_wait_num) ?
(ulong)((double)rpl_semi_sync_master_net_wait_time /
((double)rpl_semi_sync_master_net_wait_num)) : 0);
unlock();
}
void Repl_semi_sync_master::reset_stats()
{
lock();
rpl_semi_sync_master_yes_transactions = 0;
rpl_semi_sync_master_no_transactions = 0;
rpl_semi_sync_master_off_times = 0;
rpl_semi_sync_master_timefunc_fails = 0;
rpl_semi_sync_master_wait_sessions = 0;
rpl_semi_sync_master_wait_pos_backtraverse = 0;
rpl_semi_sync_master_trx_wait_num = 0;
rpl_semi_sync_master_trx_wait_time = 0;
rpl_semi_sync_master_net_wait_num = 0;
rpl_semi_sync_master_net_wait_time = 0;
unlock();
}
void Repl_semi_sync_master::await_all_slave_replies(const char *msg)
{
struct timespec timeout;
int wait_result= 0;
bool first= true;
DBUG_ENTER("Repl_semi_sync_master::::await_all_slave_replies");
/*
Wait for all transactions that need ACKS to have received them; or timeout.
If it is a timeout, the connection thread should attempt to turn off
semi-sync and broadcast to all other waiting threads to move on.
COND_binlog_send is only signalled after the Active_tranx cache has been
emptied.
*/
create_timeout(&timeout, NULL);
lock();
while (get_master_enabled() && is_on() && !m_active_tranxs->is_empty() && !wait_result)
{
if (msg && first)
{
first= false;
sql_print_information("%s", msg);
}
wait_result=
mysql_cond_timedwait(&COND_binlog_send, &LOCK_binlog, &timeout);
}
unlock();
DBUG_VOID_RETURN;
}
/* Get the waiting time given the wait's staring time.
*
* Return:
* >= 0: the waiting time in microseconds(us)
* < 0: error in get time or time back traverse
*/
static int get_wait_time(const struct timespec& start_ts)
{
ulonglong start_usecs, end_usecs;
struct timespec end_ts;
/* Starting time in microseconds(us). */
start_usecs = timespec_to_usec(&start_ts);
/* Get the wait time interval. */
set_timespec(end_ts, 0);
/* Ending time in microseconds(us). */
end_usecs = timespec_to_usec(&end_ts);
if (end_usecs < start_usecs)
return -1;
return (int)(end_usecs - start_usecs);
}
void semi_sync_master_deinit()
{
repl_semisync_master.cleanup();
ack_receiver.cleanup();
}
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.40Angebot
¤
*Bot Zugriff
|
|
2026-11-24
|
|
|
|
|