Commit 99df0fba authored by Nirbhay Choubey's avatar Nirbhay Choubey

bzr merge -r3968..3984 codership/5.5 (non-Innodb changes only).

parent 8a6f4e19
...@@ -20,6 +20,7 @@ set -u ...@@ -20,6 +20,7 @@ set -u
WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_BYPASS=0
WSREP_SST_OPT_DATA="" WSREP_SST_OPT_DATA=""
WSREP_SST_OPT_AUTH=""
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
...@@ -55,7 +56,7 @@ case "$1" in ...@@ -55,7 +56,7 @@ case "$1" in
shift shift
;; ;;
'--password') '--password')
readonly WSREP_SST_OPT_PSWD="$2" WSREP_SST_OPT_PSWD="$2"
shift shift
;; ;;
'--port') '--port')
...@@ -71,7 +72,7 @@ case "$1" in ...@@ -71,7 +72,7 @@ case "$1" in
shift shift
;; ;;
'--user') '--user')
readonly WSREP_SST_OPT_USER="$2" WSREP_SST_OPT_USER="$2"
shift shift
;; ;;
'--gtid') '--gtid')
...@@ -88,8 +89,8 @@ done ...@@ -88,8 +89,8 @@ done
readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BYPASS
# For Bug:1200727 # For Bug:1200727
if my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then if my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then
if [ -z $WSREP_SST_OPT_AUTH -o $WSREP_SST_OPT_AUTH = "(null)" ];then if [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ];then
WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2)
fi fi
fi fi
...@@ -124,4 +125,3 @@ wsrep_cleanup_progress_file() ...@@ -124,4 +125,3 @@ wsrep_cleanup_progress_file()
{ {
[ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null [ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null
} }
#!/bin/sh -e #!/bin/bash -e
# Copyright (C) 2009 Codership Oy # Copyright (C) 2009 Codership Oy
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to the # along with this program; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
...@@ -65,6 +65,11 @@ then ...@@ -65,6 +65,11 @@ then
exit $EINVAL exit $EINVAL
fi fi
# For Bug:1293798
if [ -z "$WSREP_SST_OPT_PSWD" -a -n "$WSREP_SST_OPT_AUTH" ]; then
WSREP_SST_OPT_USER=$(echo $WSREP_SST_OPT_AUTH | cut -d: -f1)
WSREP_SST_OPT_PSWD=$(echo $WSREP_SST_OPT_AUTH | cut -d: -f2)
fi
AUTH="-u$WSREP_SST_OPT_USER" AUTH="-u$WSREP_SST_OPT_USER"
if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi
...@@ -123,4 +128,5 @@ else ...@@ -123,4 +128,5 @@ else
wsrep_log_info "Bypassing state dump." wsrep_log_info "Bypassing state dump."
echo $SET_START_POSITION | $MYSQL echo $SET_START_POSITION | $MYSQL
fi fi
wsrep_cleanup_progress_file
#
...@@ -25,6 +25,9 @@ OS=$(uname) ...@@ -25,6 +25,9 @@ OS=$(uname)
. $(dirname $0)/wsrep_sst_common . $(dirname $0)/wsrep_sst_common
# Setting the path for lsof on CentOS
export PATH="/usr/sbin:/sbin:$PATH"
cleanup_joiner() cleanup_joiner()
{ {
wsrep_log_info "Joiner cleanup." wsrep_log_info "Joiner cleanup."
...@@ -49,19 +52,21 @@ check_pid() ...@@ -49,19 +52,21 @@ check_pid()
check_pid_and_port() check_pid_and_port()
{ {
local pid_file=$1 local pid_file=$1
local rsync_pid=$(cat $pid_file) local rsync_pid=$2
local rsync_port=$2 local rsync_port=$3
if [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ]; then local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \
# no netstat --program(-p) option in Darwin and FreeBSD grep "(LISTEN)")
check_pid $pid_file && \ local is_rsync=$(echo $port_info | \
lsof -i -Pn 2>/dev/null | \ grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)
grep "(LISTEN)" | grep ":$rsync_port" | grep -w '^rsync[[:space:]]\+'"$rsync_pid" >/dev/null
else if [ -n "$port_info" -a -z "$is_rsync" ]; then
check_pid $pid_file && \ wsrep_log_error "rsync daemon port '$rsync_port' has been taken"
netstat -lnpt 2>/dev/null | \ exit 16 # EBUSY
grep LISTEN | grep \:$rsync_port | grep $rsync_pid/rsync >/dev/null
fi fi
check_pid $pid_file && \
[ -n "$port_info" ] && [ -n "$is_rsync" ] && \
[ $(cat $pid_file) -eq $rsync_pid ]
} }
MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
...@@ -234,9 +239,10 @@ EOF ...@@ -234,9 +239,10 @@ EOF
# rm -rf "$DATA"/ib_logfile* # we don't want old logs around # rm -rf "$DATA"/ib_logfile* # we don't want old logs around
# listen at all interfaces (for firewalled setups) # listen at all interfaces (for firewalled setups)
rsync --daemon --port $RSYNC_PORT --config "$RSYNC_CONF" rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" &
RSYNC_REAL_PID=$!
until check_pid_and_port $RSYNC_PID $RSYNC_PORT until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_PORT
do do
sleep 0.2 sleep 0.2
done done
......
...@@ -4370,6 +4370,9 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4370,6 +4370,9 @@ pthread_handler_t handle_slave_sql(void *arg)
my_off_t saved_skip= 0; my_off_t saved_skip= 0;
Master_info *mi= ((Master_info*)arg); Master_info *mi= ((Master_info*)arg);
Relay_log_info* rli = &mi->rli; Relay_log_info* rli = &mi->rli;
#ifdef WITH_WSREP
my_bool wsrep_node_dropped= FALSE;
#endif /* WITH_WSREP */
const char *errmsg; const char *errmsg;
rpl_group_info *serial_rgi; rpl_group_info *serial_rgi;
rpl_sql_thread_info sql_info(mi->rpl_filter); rpl_sql_thread_info sql_info(mi->rpl_filter);
...@@ -4377,6 +4380,9 @@ pthread_handler_t handle_slave_sql(void *arg) ...@@ -4377,6 +4380,9 @@ pthread_handler_t handle_slave_sql(void *arg)
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init(); my_thread_init();
DBUG_ENTER("handle_slave_sql"); DBUG_ENTER("handle_slave_sql");
#ifdef WITH_WSREP
wsrep_restart_point:
#endif /* WITH_WSREP */
LINT_INIT(saved_master_log_pos); LINT_INIT(saved_master_log_pos);
LINT_INIT(saved_log_pos); LINT_INIT(saved_log_pos);
...@@ -4617,7 +4623,15 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME, ...@@ -4617,7 +4623,15 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
DBUG_PRINT("info", ("exec_relay_log_event() failed")); DBUG_PRINT("info", ("exec_relay_log_event() failed"));
// do not scare the user if SQL thread was simply killed or stopped // do not scare the user if SQL thread was simply killed or stopped
if (!sql_slave_killed(serial_rgi)) if (!sql_slave_killed(serial_rgi))
{
slave_output_error_info(rli, thd); slave_output_error_info(rli, thd);
#ifdef WITH_WSREP
if (WSREP_ON && last_errno == ER_UNKNOWN_COM_ERROR)
{
wsrep_node_dropped= TRUE;
}
#endif /* WITH_WSREP */
}
goto err; goto err;
} }
} }
...@@ -4702,6 +4716,27 @@ err_during_init: ...@@ -4702,6 +4716,27 @@ err_during_init:
delete serial_rgi; delete serial_rgi;
delete thd; delete thd;
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
#ifdef WITH_WSREP
/* if slave stopped due to node going non primary, we set global flag to
trigger automatic restart of slave when node joins back to cluster
*/
if (wsrep_node_dropped && wsrep_restart_slave)
{
if (wsrep_ready)
{
WSREP_INFO("Slave error due to node temporarily non-primary"
"SQL slave will continue");
wsrep_node_dropped= FALSE;
mysql_mutex_unlock(&rli->run_lock);
goto wsrep_restart_point;
} else {
WSREP_INFO("Slave error due to node going non-primary");
WSREP_INFO("wsrep_restart_slave was set and therefore slave will be "
"automatically restarted when node joins back to cluster");
wsrep_restart_slave_activated= TRUE;
}
}
#endif /* WITH_WSREP */
/* /*
Note: the order of the broadcast and unlock calls below (first broadcast, then unlock) Note: the order of the broadcast and unlock calls below (first broadcast, then unlock)
is important. Otherwise a killer_thread can execute between the calls and is important. Otherwise a killer_thread can execute between the calls and
...@@ -4711,22 +4746,6 @@ err_during_init: ...@@ -4711,22 +4746,6 @@ err_during_init:
DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5);); DBUG_EXECUTE_IF("simulate_slave_delay_at_terminate_bug38694", sleep(5););
mysql_mutex_unlock(&rli->run_lock); // tell the world we are done mysql_mutex_unlock(&rli->run_lock); // tell the world we are done
#ifdef WITH_WSREP
/* if slave stopped due to node going non primary, we set global flag to
trigger automatic restart of slave when node joins back to cluster
*/
if (WSREP_ON && !wsrep_ready)
{
WSREP_INFO("Slave thread stopped because node dropped from cluster");
if (wsrep_restart_slave)
{
WSREP_INFO("wsrep_restart_slave was set and therefore slave will be "
"automatically restarted when node joins back to cluster");
wsrep_restart_slave_activated= TRUE;
}
}
#endif /* WITH_WSREP */
DBUG_LEAVE; // Must match DBUG_ENTER() DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end(); my_thread_end();
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
......
...@@ -4598,6 +4598,7 @@ restart: ...@@ -4598,6 +4598,7 @@ restart:
thd->lex->sql_command== SQLCOM_LOAD || thd->lex->sql_command== SQLCOM_LOAD ||
thd->lex->sql_command== SQLCOM_DELETE) && thd->lex->sql_command== SQLCOM_DELETE) &&
wsrep_replicate_myisam && wsrep_replicate_myisam &&
(*start) &&
(*start)->table && (*start)->table->file->ht->db_type == DB_TYPE_MYISAM) (*start)->table && (*start)->table->file->ht->db_type == DB_TYPE_MYISAM)
{ {
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start)); WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (*start));
......
...@@ -513,11 +513,17 @@ wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all) ...@@ -513,11 +513,17 @@ wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all)
DBUG_RETURN(WSREP_TRX_CERT_FAIL); DBUG_RETURN(WSREP_TRX_CERT_FAIL);
case WSREP_SIZE_EXCEEDED:
WSREP_ERROR("transaction size exceeded");
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
DBUG_RETURN(WSREP_TRX_SIZE_EXCEEDED);
case WSREP_CONN_FAIL: case WSREP_CONN_FAIL:
WSREP_ERROR("connection failure"); WSREP_ERROR("connection failure");
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
DBUG_RETURN(WSREP_TRX_ERROR); DBUG_RETURN(WSREP_TRX_ERROR);
default: default:
WSREP_ERROR("unknown connection failure"); WSREP_ERROR("unknown connection failure");
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
DBUG_RETURN(WSREP_TRX_ERROR); DBUG_RETURN(WSREP_TRX_ERROR);
} }
......
...@@ -64,10 +64,10 @@ ulong wsrep_mysql_replication_bundle = 0; ...@@ -64,10 +64,10 @@ ulong wsrep_mysql_replication_bundle = 0;
my_bool wsrep_desync = 0; // desynchronize the node from the my_bool wsrep_desync = 0; // desynchronize the node from the
// cluster // cluster
my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals my_bool wsrep_load_data_splitting = 1; // commit load data every 10K intervals
my_bool wsrep_restart_slave = 0; // should mysql slave thread be my_bool wsrep_restart_slave = 0; // should mysql slave thread be
// restarted, if node joins back // restarted, if node joins back
my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave my_bool wsrep_restart_slave_activated = 0; // node has dropped, and slave
// restart will be needed // restart will be needed
/* /*
* End configuration options * End configuration options
*/ */
...@@ -433,9 +433,22 @@ static void wsrep_synced_cb(void* app_ctx) ...@@ -433,9 +433,22 @@ static void wsrep_synced_cb(void* app_ctx)
} }
if (wsrep_restart_slave_activated) if (wsrep_restart_slave_activated)
{ {
int rcode;
WSREP_INFO("MySQL slave restart"); WSREP_INFO("MySQL slave restart");
wsrep_restart_slave_activated= FALSE; wsrep_restart_slave_activated= FALSE;
init_slave();
mysql_mutex_lock(&LOCK_active_mi);
if ((rcode = start_slave_threads(1 /* need mutex */,
0 /* no wait for start*/,
active_mi,
master_info_file,
relay_log_info_file,
SLAVE_SQL)))
{
WSREP_WARN("Failed to create slave threads: %d", rcode);
}
mysql_mutex_unlock(&LOCK_active_mi);
} }
} }
...@@ -526,6 +539,7 @@ int wsrep_init() ...@@ -526,6 +539,7 @@ int wsrep_init()
{ {
DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
wsrep->free(wsrep);
free(wsrep); free(wsrep);
wsrep = NULL; wsrep = NULL;
} }
...@@ -670,6 +684,7 @@ int wsrep_init() ...@@ -670,6 +684,7 @@ int wsrep_init()
{ {
DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode)); DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode); WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
wsrep->free(wsrep);
free(wsrep); free(wsrep);
wsrep = NULL; wsrep = NULL;
} else { } else {
...@@ -1214,7 +1229,7 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) ...@@ -1214,7 +1229,7 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
} }
buff.append(STRING_WITH_LEN(" AS ")); buff.append(STRING_WITH_LEN(" AS "));
//buff.append(views->source.str, views->source.length); //buff.append(views->source.str, views->source.length);
buff.append(thd->lex->create_view_select.str, buff.append(thd->lex->create_view_select.str,
thd->lex->create_view_select.length); thd->lex->create_view_select.length);
//int errcode= query_error_code(thd, TRUE); //int errcode= query_error_code(thd, TRUE);
//if (thd->binlog_query(THD::STMT_QUERY_TYPE, //if (thd->binlog_query(THD::STMT_QUERY_TYPE,
...@@ -1223,7 +1238,7 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) ...@@ -1223,7 +1238,7 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
} }
static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
const TABLE_LIST* table_list) const TABLE_LIST* table_list)
{ {
wsrep_status_t ret(WSREP_WARNING); wsrep_status_t ret(WSREP_WARNING);
uchar* buf(0); uchar* buf(0);
...@@ -1248,7 +1263,7 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, ...@@ -1248,7 +1263,7 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
buf_err= wsrep_create_event_query(thd, &buf, &buf_len); buf_err= wsrep_create_event_query(thd, &buf, &buf_len);
break; break;
default: default:
buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf, buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf,
&buf_len); &buf_len);
break; break;
} }
...@@ -1298,7 +1313,7 @@ static void wsrep_TOI_end(THD *thd) { ...@@ -1298,7 +1313,7 @@ static void wsrep_TOI_end(THD *thd) {
} }
} }
static int wsrep_RSU_begin(THD *thd, char *db_, char *table_) static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
{ {
wsrep_status_t ret(WSREP_WARNING); wsrep_status_t ret(WSREP_WARNING);
WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd),
...@@ -1380,9 +1395,9 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ...@@ -1380,9 +1395,9 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
int ret= 0; int ret= 0;
mysql_mutex_lock(&thd->LOCK_wsrep_thd); mysql_mutex_lock(&thd->LOCK_wsrep_thd);
if (thd->wsrep_conflict_state == MUST_ABORT) if (thd->wsrep_conflict_state == MUST_ABORT)
{ {
WSREP_INFO("thread: %lu, %s has been aborted due to multi-master conflict", WSREP_INFO("thread: %lu, %s has been aborted due to multi-master conflict",
thd->thread_id, thd->query()); thd->thread_id, thd->query());
mysql_mutex_unlock(&thd->LOCK_wsrep_thd); mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
return WSREP_TRX_FAIL; return WSREP_TRX_FAIL;
...@@ -1401,7 +1416,7 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, ...@@ -1401,7 +1416,7 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (wsrep_debug && thd->mdl_context.has_locks()) if (wsrep_debug && thd->mdl_context.has_locks())
{ {
WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu", WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu",
thd->query(), thd->thread_id); thd->query(), thd->thread_id);
} }
...@@ -1493,7 +1508,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx, ...@@ -1493,7 +1508,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd); mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
ret = TRUE; ret = TRUE;
} }
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
{ {
WSREP_DEBUG("DROP caused BF abort"); WSREP_DEBUG("DROP caused BF abort");
ticket->wsrep_report(wsrep_debug); ticket->wsrep_report(wsrep_debug);
...@@ -1501,7 +1516,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx, ...@@ -1501,7 +1516,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
ret = FALSE; ret = FALSE;
} }
else if (granted_thd->wsrep_query_state == QUERY_COMMITTING) else if (granted_thd->wsrep_query_state == QUERY_COMMITTING)
{ {
WSREP_DEBUG("mdl granted, but commiting thd abort scheduled"); WSREP_DEBUG("mdl granted, but commiting thd abort scheduled");
ticket->wsrep_report(wsrep_debug); ticket->wsrep_report(wsrep_debug);
...@@ -1509,7 +1524,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx, ...@@ -1509,7 +1524,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1); wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
ret = FALSE; ret = FALSE;
} }
else else
{ {
WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", request_thd, granted_thd); WSREP_MDL_LOG(DEBUG, "MDL conflict-> BF abort", request_thd, granted_thd);
ticket->wsrep_report(wsrep_debug); ticket->wsrep_report(wsrep_debug);
......
...@@ -75,15 +75,18 @@ void wsrep_notify_status (wsrep_member_status_t status, ...@@ -75,15 +75,18 @@ void wsrep_notify_status (wsrep_member_status_t status,
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
" --index %d", view->my_idx); " --index %d", view->my_idx);
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members"); if (view->memb_num)
for (int i = 0; i < view->memb_num; i++)
{ {
wsrep_uuid_print (&view->members[i].id, uuid_str, sizeof(uuid_str)); cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, " --members");
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
"%c%s/%s/%s", i > 0 ? ',' : ' ', for (int i = 0; i < view->memb_num; i++)
uuid_str, view->members[i].name, {
view->members[i].incoming); wsrep_uuid_print (&view->members[i].id, uuid_str, sizeof(uuid_str));
cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off,
"%c%s/%s/%s", i > 0 ? ',' : ' ',
uuid_str, view->members[i].name,
view->members[i].incoming);
}
} }
} }
......
...@@ -113,7 +113,7 @@ bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var) ...@@ -113,7 +113,7 @@ bool wsrep_sst_receive_address_check (sys_var *self, THD* thd, set_var* var)
return 0; return 0;
} }
bool wsrep_sst_receive_address_update (sys_var *self, THD* thd, bool wsrep_sst_receive_address_update (sys_var *self, THD* thd,
enum_var_type type) enum_var_type type)
{ {
return 0; return 0;
...@@ -138,7 +138,7 @@ static bool sst_auth_real_set (const char* value) ...@@ -138,7 +138,7 @@ static bool sst_auth_real_set (const char* value)
{ {
my_free ((void*)wsrep_sst_auth); my_free ((void*)wsrep_sst_auth);
wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0)); wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0));
//strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK, //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK,
// sizeof(wsrep_sst_auth) - 1); // sizeof(wsrep_sst_auth) - 1);
} }
else else
...@@ -763,9 +763,11 @@ static int sst_donate_mysqldump (const char* addr, ...@@ -763,9 +763,11 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_PORT" '%s' " WSREP_SST_OPT_PORT" '%s' "
WSREP_SST_OPT_LPORT" '%u' " WSREP_SST_OPT_LPORT" '%u' "
WSREP_SST_OPT_SOCKET" '%s' " WSREP_SST_OPT_SOCKET" '%s' "
WSREP_SST_OPT_CONF" '%s' "
WSREP_SST_OPT_GTID" '%s:%lld'" WSREP_SST_OPT_GTID" '%s:%lld'"
"%s", "%s",
user, pswd, host, port, mysqld_port, mysqld_unix_port, uuid_str, user, pswd, host, port, mysqld_port, mysqld_unix_port,
wsrep_defaults_file, uuid_str,
(long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : ""); (long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : "");
WSREP_DEBUG("Running: '%s'", cmd_str); WSREP_DEBUG("Running: '%s'", cmd_str);
...@@ -799,7 +801,7 @@ static int run_sql_command(THD *thd, const char *query) ...@@ -799,7 +801,7 @@ static int run_sql_command(THD *thd, const char *query)
int const err= thd->get_stmt_da()->sql_errno(); int const err= thd->get_stmt_da()->sql_errno();
WSREP_WARN ("error executing '%s': %d (%s)%s", WSREP_WARN ("error executing '%s': %d (%s)%s",
query, err, thd->get_stmt_da()->message(), query, err, thd->get_stmt_da()->message(),
err == ER_UNKNOWN_SYSTEM_VARIABLE ? err == ER_UNKNOWN_SYSTEM_VARIABLE ?
". Was mysqld built with --with-innodb-disallow-writes ?" : ""); ". Was mysqld built with --with-innodb-disallow-writes ?" : "");
thd->clear_error(); thd->clear_error();
return -1; return -1;
......
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h>
/*! Dummy backend context. */ /*! Dummy backend context. */
typedef struct wsrep_dummy typedef struct wsrep_dummy
{ {
wsrep_log_cb_t log_fn; wsrep_log_cb_t log_fn;
char* options;
} wsrep_dummy_t; } wsrep_dummy_t;
/* Get pointer to wsrep_dummy context from wsrep_t pointer */ /* Get pointer to wsrep_dummy context from wsrep_t pointer */
...@@ -44,10 +42,6 @@ typedef struct wsrep_dummy ...@@ -44,10 +42,6 @@ typedef struct wsrep_dummy
static void dummy_free(wsrep_t *w) static void dummy_free(wsrep_t *w)
{ {
WSREP_DBUG_ENTER(w); WSREP_DBUG_ENTER(w);
if (WSREP_DUMMY(w)->options)
{
free(WSREP_DUMMY(w)->options);
}
free(w->ctx); free(w->ctx);
w->ctx = NULL; w->ctx = NULL;
} }
...@@ -55,15 +49,8 @@ static void dummy_free(wsrep_t *w) ...@@ -55,15 +49,8 @@ static void dummy_free(wsrep_t *w)
static wsrep_status_t dummy_init (wsrep_t* w, static wsrep_status_t dummy_init (wsrep_t* w,
const struct wsrep_init_args* args) const struct wsrep_init_args* args)
{ {
WSREP_DBUG_ENTER(w);
WSREP_DUMMY(w)->log_fn = args->logger_cb; WSREP_DUMMY(w)->log_fn = args->logger_cb;
if (args->options) WSREP_DBUG_ENTER(w);
{
char* options = malloc(strlen(args->options) + 1);
if (options == NULL) return WSREP_WARNING;
strcpy(options, args->options);
WSREP_DUMMY(w)->options = options;
}
return WSREP_OK; return WSREP_OK;
} }
...@@ -74,41 +61,16 @@ static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused))) ...@@ -74,41 +61,16 @@ static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused)))
static wsrep_status_t dummy_options_set( static wsrep_status_t dummy_options_set(
wsrep_t* w, wsrep_t* w,
const char* conf) const char* conf __attribute__((unused)))
{ {
char* options = NULL; WSREP_DBUG_ENTER(w);
WSREP_DBUG_ENTER(w);
// concatenate config string with ';'
options = WSREP_DUMMY(w)->options;
if (options == NULL)
{
options = malloc(strlen(conf) + 1);
if (options == NULL)
{
return WSREP_WARNING;
}
strcpy(options, conf);
} else {
int opt_len = strlen(options);
char* p = realloc(options,
opt_len + 1 + // ';'
strlen(conf) + 1); // \0
if (p == NULL)
{
return WSREP_WARNING;
}
p[opt_len] = ';';
strcpy(p + opt_len + 1, conf);
options = p;
}
WSREP_DUMMY(w)->options = options;
return WSREP_OK; return WSREP_OK;
} }
static char* dummy_options_get (wsrep_t* w) static char* dummy_options_get (wsrep_t* w)
{ {
WSREP_DBUG_ENTER(w); WSREP_DBUG_ENTER(w);
return WSREP_DUMMY(w)->options; return NULL;
} }
static wsrep_status_t dummy_connect( static wsrep_status_t dummy_connect(
...@@ -423,8 +385,6 @@ int wsrep_dummy_loader(wsrep_t* w) ...@@ -423,8 +385,6 @@ int wsrep_dummy_loader(wsrep_t* w)
// initialize private context // initialize private context
WSREP_DUMMY(w)->log_fn = NULL; WSREP_DUMMY(w)->log_fn = NULL;
WSREP_DUMMY(w)->options = NULL;
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment