Commit adc6bd15 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Merged changeset from codership-mysql/5.5.

* bzr merge -r3980..3984 codership-mysql/5.5
* bzr merge -r3985..3997 codership-mysql/5.5
* Fixed a segfault.
* Modified wsrep.variables test & fixed a warning
  in mtr script.
parents b441c510 93cc06b2
......@@ -12,6 +12,7 @@
*.dll
*.dsp
*.dylib
*.diff
*.exe
*.exp
*.gcda
......
......@@ -23,7 +23,7 @@ SET(WSREP_PATCH_VERSION "10")
# MariaDB addition: Revision number of the last revision merged from
# codership branch visible in @@visible_comment.
# Branch : codership-mysql/5.5
SET(WSREP_PATCH_REVNO "3980") # Should be updated on every merge.
SET(WSREP_PATCH_REVNO "3997") # Should be updated on every merge.
# MariaDB: Obtain patch revision number:
# Update WSREP_PATCH_REVNO if WSREP_REV environment variable is set.
......
......@@ -2406,7 +2406,7 @@ sub environment_setup {
$ENV{'WSREP_PROVIDER'}= $file_wsrep_provider;
}
if ($ENV{'WSREP_PROVIDER'} ne "") {
if ((defined $ENV{'WSREP_PROVIDER'}) && ($ENV{'WSREP_PROVIDER'} ne "")) {
mtr_verbose("WSREP_PROVIDER set to $ENV{'WSREP_PROVIDER'}");
} else {
mtr_verbose("WSREP_PROVIDER isn't available");
......
......@@ -19,13 +19,13 @@ call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_sla
call mtr.add_suppression("WSREP: Failed to get provider options");
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
none
libgalera_smm.so
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
1
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
NULL
SHOW STATUS LIKE 'threads_connected';
Variable_name Value
Threads_connected 1
......@@ -33,10 +33,9 @@ SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
wsrep_thread_count 0
SET GLOBAL wsrep_provider= '/usr/lib/galera/libgalera_smm.so';
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
/usr/lib/galera/libgalera_smm.so
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
NULL
......@@ -53,7 +52,7 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://';
# Wait for applier threads to get created.
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
/usr/lib/galera/libgalera_smm.so
libgalera_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
gcomm://
......@@ -74,6 +73,7 @@ SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
wsrep_thread_count 11
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= '';
SET GLOBAL wsrep_provider= 'none';
SET GLOBAL wsrep_provider_options= '';
# End of test.
......@@ -5,6 +5,10 @@
--echo #
--echo # Testing wsrep_replicate_myisam variable.
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.wsrep_replicate_myisam;
SELECT @@global.wsrep_replicate_myisam;
......@@ -22,6 +26,7 @@ SET GLOBAL wsrep_replicate_myisam= OFF;
--echo #
call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_slave_threads' and 'LOCK_global_system_variables'");
call mtr.add_suppression("WSREP: Failed to get provider options");
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_slave_threads;
SELECT @@global.wsrep_cluster_address;
......@@ -29,7 +34,11 @@ SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
--echo
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
--enable_query_log
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SHOW STATUS LIKE 'threads_connected';
......@@ -41,6 +50,8 @@ SHOW STATUS LIKE 'wsrep_thread_count';
SET GLOBAL wsrep_cluster_address= 'gcomm://';
--echo # Wait for applier threads to get created.
sleep 3;
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider;
SELECT @@global.wsrep_cluster_address;
SHOW STATUS LIKE 'threads_connected';
......@@ -56,8 +67,9 @@ SHOW STATUS LIKE 'wsrep_thread_count';
# reset (for mtr internal checks)
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= '';
SET GLOBAL wsrep_provider= 'none';
SET GLOBAL wsrep_provider_options= '';
--echo # End of test.
# Copyright (C) 2012 Codership Oy
# Copyright (C) 2012-2014 Codership Oy
#
# 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
......@@ -20,6 +20,7 @@ set -u
WSREP_SST_OPT_BYPASS=0
WSREP_SST_OPT_DATA=""
WSREP_SST_OPT_AUTH=""
while [ $# -gt 0 ]; do
case "$1" in
......@@ -55,7 +56,7 @@ case "$1" in
shift
;;
'--password')
readonly WSREP_SST_OPT_PSWD="$2"
WSREP_SST_OPT_PSWD="$2"
shift
;;
'--port')
......@@ -71,7 +72,7 @@ case "$1" in
shift
;;
'--user')
readonly WSREP_SST_OPT_USER="$2"
WSREP_SST_OPT_USER="$2"
shift
;;
'--gtid')
......@@ -89,7 +90,7 @@ readonly WSREP_SST_OPT_BYPASS
# For Bug:1200727
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)
fi
fi
......@@ -125,3 +126,26 @@ wsrep_cleanup_progress_file()
[ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null
}
wsrep_check_program()
{
local prog=$1
if ! which $prog >/dev/null
then
echo "'$prog' not found in PATH"
return 2 # no such file or directory
fi
}
wsrep_check_programs()
{
local ret=0
while [ $# -gt 0 ]
do
wsrep_check_program $1 || ret=$?
shift
done
return $ret
}
#!/bin/sh -e
#!/bin/bash -e
# Copyright (C) 2009 Codership Oy
#
# This program is free software; you can redistribute it and/or modify
......@@ -61,6 +61,11 @@ then
exit $EINVAL
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"
if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi
......
#!/bin/bash -ue
# Copyright (C) 2010 Codership Oy
# Copyright (C) 2010-2014 Codership Oy
#
# 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
......@@ -28,6 +28,8 @@ export PATH="/usr/sbin:/sbin:$PATH"
. $(dirname $0)/wsrep_sst_common
wsrep_check_programs rsync
cleanup_joiner()
{
wsrep_log_info "Joiner cleanup."
......@@ -202,6 +204,8 @@ then
elif [ "$WSREP_SST_OPT_ROLE" = "joiner" ]
then
wsrep_check_programs lsof
touch $SST_PROGRESS_FILE
MYSQLD_PID=$WSREP_SST_OPT_PARENT
......
......@@ -63,6 +63,10 @@ STATDIR=""
uextra=0
disver=""
tmpopts=""
itmpdir=""
xtmpdir=""
scomp=""
sdecomp=""
......@@ -236,7 +240,7 @@ parse_cnf()
get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(du --block-size=1 -c **/*.ibd **/*.MYI **/*.MYI ibdata1 | awk 'END { print $1 }')
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | xargs -0 du --block-size=1 -c | awk 'END { print $1 }')
if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
......@@ -299,6 +303,7 @@ read_cnf()
iopts=$(parse_cnf sst inno-backup-opts "")
iapts=$(parse_cnf sst inno-apply-opts "")
impts=$(parse_cnf sst inno-move-opts "")
stimeout=$(parse_cnf sst sst-initial-timeout 100)
}
get_stream()
......@@ -370,20 +375,29 @@ cleanup_donor()
wsrep_log_error "Cleanup after exit with status:$estatus"
fi
if [[ -n $XTRABACKUP_PID ]];then
if [[ -n ${XTRABACKUP_PID:-} ]];then
if check_pid $XTRABACKUP_PID
then
wsrep_log_error "xtrabackup process is still running. Killing... "
kill_xtrabackup
fi
rm -f $XTRABACKUP_PID
fi
rm -f ${DATA}/${IST_FILE}
rm -f ${DATA}/${IST_FILE} || true
if [[ -n $progress && -p $progress ]];then
wsrep_log_info "Cleaning up fifo file $progress"
rm $progress
rm -f $progress || true
fi
wsrep_log_info "Cleaning up temporary directories"
if [[ -n $xtmpdir ]];then
[[ -d $xtmpdir ]] && rm -rf $xtmpdir || true
fi
if [[ -n $itmpdir ]];then
[[ -d $itmpdir ]] && rm -rf $itmpdir || true
fi
}
......@@ -391,7 +405,8 @@ kill_xtrabackup()
{
local PID=$(cat $XTRABACKUP_PID)
[ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || :
rm -f "$XTRABACKUP_PID"
wsrep_log_info "Removing xtrabackup pid file $XTRABACKUP_PID"
rm -f "$XTRABACKUP_PID" || true
}
setup_ports()
......@@ -453,13 +468,30 @@ recv_joiner()
{
local dir=$1
local msg=$2
local tmt=$3
local ltcmd
pushd ${dir} 1>/dev/null
set +e
if [[ $tmt -gt 0 && -x `which timeout` ]];then
if timeout --help | grep -q -- '-k';then
ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd"
else
ltcmd="timeout $tmt $tcmd"
fi
timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
else
timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
fi
set -e
popd 1>/dev/null
if [[ ${RC[0]} -eq 124 ]];then
wsrep_log_error "Possible timeout in receving first data from donor in gtid stage"
exit 32
fi
for ecode in "${RC[@]}";do
if [[ $ecode -ne 0 ]];then
......@@ -501,7 +533,7 @@ send_donor()
}
if [[ ! -x `which innobackupex` ]];then
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
wsrep_log_error "innobackupex not in path: $PATH"
exit 2
fi
......@@ -526,7 +558,7 @@ fi
INNOEXTRA=""
INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log"
INNOMOVE="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &>\${DATA}/innobackup.move.log"
INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log"
INNOBACKUP="${INNOBACKUPEX_BIN} --defaults-file=${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2>\${DATA}/innobackup.backup.log"
if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
then
......@@ -535,7 +567,14 @@ then
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
then
TMPDIR="${TMPDIR:-/tmp}"
if [[ -z $(parse_cnf mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then
xtmpdir=$(mktemp -d)
tmpopts=" --tmpdir=$xtmpdir "
wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory"
fi
itmpdir=$(mktemp -d)
wsrep_log_info "Using $itmpdir as innobackupex temporary directory"
if [ "${AUTH[0]}" != "(null)" ]; then
INNOEXTRA+=" --user=${AUTH[0]}"
......@@ -613,8 +652,8 @@ then
exit 22
fi
# innobackupex implicitly writes PID to fixed location in ${TMPDIR}
XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid"
# innobackupex implicitly writes PID to fixed location in $xtmpdir
XTRABACKUP_PID="$xtmpdir/xtrabackup_pid"
else # BYPASS FOR IST
......@@ -717,7 +756,7 @@ then
STATDIR=$(mktemp -d)
MAGIC_FILE="${STATDIR}/${INFO_FILE}"
recv_joiner $STATDIR "${stagemsg}-gtid" 1
recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout
if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
then
......@@ -871,7 +910,6 @@ then
wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable"
exit 2
fi
cat "${MAGIC_FILE}" # output UUID:seqno
wsrep_log_info "Total time on joiner: $totime seconds"
fi
......
......@@ -205,7 +205,7 @@ parse_cnf()
get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(du --block-size=1 -c **/*.ibd **/*.MYI **/*.MYI ibdata1 | awk 'END { print $1 }')
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | xargs -0 du --block-size=1 -c | awk 'END { print $1 }')
if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
......
......@@ -1467,8 +1467,21 @@ Event_job_data::execute(THD *thd, bool drop)
saved_master_access= thd->security_ctx->master_access;
thd->security_ctx->master_access |= SUPER_ACL;
#ifdef WITH_WSREP
// sql_print_information("sizeof(LEX) = %d", sizeof(struct LEX));
// sizeof(LEX) = 4512, so it's relatively safe to allocate it on stack.
LEX lex;
lex.sql_command = SQLCOM_DROP_EVENT;
thd->lex = &lex;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
#endif
ret= Events::drop_event(thd, dbname, name, FALSE);
#ifdef WITH_WSREP
WSREP_TO_ISOLATION_END;
error:
#endif
thd->security_ctx->master_access= saved_master_access;
}
}
......
......@@ -1104,6 +1104,20 @@ Events::load_events_from_db(THD *thd)
delete et;
goto end;
}
#ifdef WITH_WSREP
// when SST from master node who initials event, the event status is ENABLED
// this is problematic because there are two nodes with same events and both enabled.
if (et->originator != thd->server_id)
{
store_record(table, record[1]);
table->field[ET_FIELD_STATUS]->
store((longlong) Event_parse_data::SLAVESIDE_DISABLED,
TRUE);
(void) table->file->ha_update_row(table->record[1], table->record[0]);
delete et;
continue;
}
#endif
drop_on_completion= (et->on_completion ==
Event_parse_data::ON_COMPLETION_DROP);
......@@ -1158,6 +1172,33 @@ int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len)
}
return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
}
static int
wsrep_alter_query_string(THD *thd, String *buf)
{
/* Append the "ALTER" part of the query */
if (buf->append(STRING_WITH_LEN("ALTER ")))
return 1;
/* Append definer */
append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host));
/* Append the left part of thd->query after event name part */
if (buf->append(thd->lex->stmt_definition_begin,
thd->lex->stmt_definition_end -
thd->lex->stmt_definition_begin))
return 1;
return 0;
}
int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len)
{
String log_query;
if (wsrep_alter_query_string(thd, &log_query))
{
WSREP_WARN("events alter string failed: %s", thd->query());
return 1;
}
return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len);
}
#endif /* WITH_WSREP */
/**
@} (End of group Event_Scheduler)
......
......@@ -2761,7 +2761,8 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
/* Mark that current_thd is not valid anymore */
my_pthread_setspecific_ptr(THR_THD, 0);
#ifdef WITH_WSREP
if (put_in_cache && !thd->wsrep_applier)
const bool wsrep_applier(thd->wsrep_applier);
if (put_in_cache && !wsrep_applier)
#else
if (put_in_cache)
#endif /* WITH_WSREP */
......
......@@ -6550,7 +6550,7 @@ alter:
}
view_tail
{}
| ALTER definer_opt EVENT_SYM sp_name
| ALTER definer_opt remember_name EVENT_SYM sp_name
{
/*
It is safe to use Lex->spname because
......@@ -6562,9 +6562,12 @@ alter:
if (!(Lex->event_parse_data= Event_parse_data::new_instance(thd)))
MYSQL_YYABORT;
Lex->event_parse_data->identifier= $4;
Lex->event_parse_data->identifier= $5;
Lex->sql_command= SQLCOM_ALTER_EVENT;
#ifdef WITH_WSREP
Lex->stmt_definition_begin= $3;
#endif
}
ev_alter_on_schedule_completion
opt_ev_rename_to
......@@ -6572,7 +6575,7 @@ alter:
opt_ev_comment
opt_ev_sql_stmt
{
if (!($6 || $7 || $8 || $9 || $10))
if (!($7 || $8 || $9 || $10 || $11))
{
my_parse_error(ER(ER_SYNTAX_ERROR));
MYSQL_YYABORT;
......@@ -6582,6 +6585,9 @@ alter:
can overwrite it
*/
Lex->sql_command= SQLCOM_ALTER_EVENT;
#ifdef WITH_WSREP
Lex->stmt_definition_end= (char*)YYLIP->get_cpp_ptr();
#endif
}
| ALTER TABLESPACE alter_tablespace_info
{
......
......@@ -509,7 +509,20 @@ int wsrep_init()
wsrep_ready_set(TRUE);
wsrep_inited= 1;
global_system_variables.wsrep_on = 0;
return 0;
wsrep_init_args args;
args.logger_cb = wsrep_log_cb;
args.options = (wsrep_provider_options) ?
wsrep_provider_options : "";
rcode = wsrep->init(wsrep, &args);
if (rcode)
{
DBUG_PRINT("wsrep",("wsrep::init() failed: %d", rcode));
WSREP_ERROR("wsrep::init() failed: %d, must shutdown", rcode);
wsrep->free(wsrep);
free(wsrep);
wsrep = NULL;
}
return rcode;
}
else
{
......@@ -1216,6 +1229,9 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_,
case SQLCOM_CREATE_EVENT:
buf_err= wsrep_create_event_query(thd, &buf, &buf_len);
break;
case SQLCOM_ALTER_EVENT:
buf_err= wsrep_alter_event_query(thd, &buf, &buf_len);
break;
default:
buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf,
&buf_len);
......
......@@ -298,6 +298,7 @@ int wsrep_to_buf_helper(
int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len);
const wsrep_uuid_t* wsrep_cluster_uuid();
struct xid_t;
......
......@@ -717,10 +717,11 @@ static int sst_donate_mysqldump (const char* addr,
WSREP_SST_OPT_LPORT" '%u' "
WSREP_SST_OPT_SOCKET" '%s' "
WSREP_SST_OPT_DATA" '%s' "
WSREP_SST_OPT_CONF" '%s' "
WSREP_SST_OPT_GTID" '%s:%lld'"
"%s",
user, pswd, host, port, mysqld_port, mysqld_unix_port,
mysql_real_data_home, uuid_str,
mysql_real_data_home, wsrep_defaults_file, uuid_str,
(long long)seqno, bypass ? " "WSREP_SST_OPT_BYPASS : "");
WSREP_DEBUG("Running: '%s'", cmd_str);
......
......@@ -23,11 +23,20 @@
#include "sql_base.h" // close_thread_tables()
#include "mysqld.h" // start_wsrep_THD();
static long long wsrep_bf_aborts_counter = 0;
#if (__LP64__)
static volatile int64 wsrep_bf_aborts_counter(0);
#define WSREP_ATOMIC_LOAD_LONG my_atomic_load64
#define WSREP_ATOMIC_ADD_LONG my_atomic_add64
#else
static volatile int32 wsrep_bf_aborts_counter(0);
#define WSREP_ATOMIC_LOAD_LONG my_atomic_load32
#define WSREP_ATOMIC_ADD_LONG my_atomic_add32
#endif
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff)
{
wsrep_local_bf_aborts = my_atomic_load64(&wsrep_bf_aborts_counter);
wsrep_local_bf_aborts = WSREP_ATOMIC_LOAD_LONG(&wsrep_bf_aborts_counter);
var->type = SHOW_LONGLONG;
var->value = (char*)&wsrep_local_bf_aborts;
return 0;
......@@ -39,7 +48,7 @@ void wsrep_client_rollback(THD *thd)
WSREP_DEBUG("client rollback due to BF abort for (%ld), query: %s",
thd->thread_id, thd->query());
my_atomic_add64(&wsrep_bf_aborts_counter, 1);
WSREP_ATOMIC_ADD_LONG(&wsrep_bf_aborts_counter, 1);
thd->wsrep_conflict_state= ABORTING;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
......
......@@ -1820,7 +1820,12 @@ lock_rec_create(
automatically of the gap type */
if (UNIV_UNLIKELY(heap_no == PAGE_HEAP_NO_SUPREMUM)) {
#ifdef WITH_WSREP
ut_ad(!(type_mode & LOCK_REC_NOT_GAP) ||
wsrep_thd_is_BF(trx->mysql_thd, FALSE));
#else
ut_ad(!(type_mode & LOCK_REC_NOT_GAP));
#endif /* WITH_WSREP */
type_mode = type_mode & ~(LOCK_GAP | LOCK_REC_NOT_GAP);
}
......@@ -2104,7 +2109,12 @@ lock_rec_add_to_queue(
struct for a gap type lock */
if (UNIV_UNLIKELY(heap_no == PAGE_HEAP_NO_SUPREMUM)) {
#ifdef WITH_WSREP
ut_ad(!(type_mode & LOCK_REC_NOT_GAP) ||
wsrep_thd_is_BF(trx->mysql_thd, FALSE));
#else
ut_ad(!(type_mode & LOCK_REC_NOT_GAP));
#endif /* WITH_WSREP */
/* There should never be LOCK_REC_NOT_GAP on a supremum
record, but let us play safe */
......
......@@ -1761,8 +1761,11 @@ row_ins_scan_sec_index_for_duplicate(
} else {
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (!wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0))
if (wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0)) {
if (!(lock_type & LOCK_REC_NOT_GAP)) {
lock_type |= LOCK_REC_NOT_GAP;
}
}
#endif /* WITH_WSREP */
err = row_ins_set_shared_rec_lock(
lock_type, block, rec, index, offsets, thr);
......
......@@ -1821,7 +1821,12 @@ lock_rec_create(
automatically of the gap type */
if (UNIV_UNLIKELY(heap_no == PAGE_HEAP_NO_SUPREMUM)) {
#ifdef WITH_WSREP
ut_ad(!(type_mode & LOCK_REC_NOT_GAP) ||
wsrep_thd_is_BF(trx->mysql_thd, FALSE));
#else
ut_ad(!(type_mode & LOCK_REC_NOT_GAP));
#endif /* WITH_WSREP */
type_mode = type_mode & ~(LOCK_GAP | LOCK_REC_NOT_GAP);
}
......@@ -2111,7 +2116,12 @@ lock_rec_add_to_queue(
struct for a gap type lock */
if (UNIV_UNLIKELY(heap_no == PAGE_HEAP_NO_SUPREMUM)) {
#ifdef WITH_WSREP
ut_ad(!(type_mode & LOCK_REC_NOT_GAP) ||
wsrep_thd_is_BF(trx->mysql_thd, FALSE));
#else
ut_ad(!(type_mode & LOCK_REC_NOT_GAP));
#endif /* WITH_WSREP */
/* There should never be LOCK_REC_NOT_GAP on a supremum
record, but let us play safe */
......
......@@ -1770,8 +1770,11 @@ row_ins_scan_sec_index_for_duplicate(
} else {
#ifdef WITH_WSREP
/* appliers don't need dupkey checks */
if (!wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0))
if (wsrep_thd_is_BF(thr_get_trx(thr)->mysql_thd, 0)) {
if (!(lock_type & LOCK_REC_NOT_GAP)) {
lock_type |= LOCK_REC_NOT_GAP;
}
}
#endif /* WITH_WSREP */
err = row_ins_set_shared_rec_lock(
lock_type, block, rec, index, offsets, thr);
......
......@@ -304,7 +304,7 @@ Version: %{mysql_version}
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
%if %{defined with_wsrep}
Requires: %{distro_requires} rsync
Requires: %{distro_requires} rsync lsof
%else
Requires: %{distro_requires}
%endif
......
......@@ -20,11 +20,13 @@
#include <errno.h>
#include <stdbool.h>
#include <string.h>
/*! Dummy backend context. */
typedef struct wsrep_dummy
{
wsrep_log_cb_t log_fn;
char* options;
} wsrep_dummy_t;
/* Get pointer to wsrep_dummy context from wsrep_t pointer */
......@@ -42,6 +44,10 @@ typedef struct wsrep_dummy
static void dummy_free(wsrep_t *w)
{
WSREP_DBUG_ENTER(w);
if (WSREP_DUMMY(w)->options) {
free(WSREP_DUMMY(w)->options);
WSREP_DUMMY(w)->options = NULL;
}
free(w->ctx);
w->ctx = NULL;
}
......@@ -51,6 +57,9 @@ static wsrep_status_t dummy_init (wsrep_t* w,
{
WSREP_DUMMY(w)->log_fn = args->logger_cb;
WSREP_DBUG_ENTER(w);
if (args->options) {
WSREP_DUMMY(w)->options = strdup(args->options);
}
return WSREP_OK;
}
......@@ -61,16 +70,23 @@ static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused)))
static wsrep_status_t dummy_options_set(
wsrep_t* w,
const char* conf __attribute__((unused)))
const char* conf)
{
WSREP_DBUG_ENTER(w);
if (WSREP_DUMMY(w)->options) {
free(WSREP_DUMMY(w)->options);
WSREP_DUMMY(w)->options = NULL;
}
if (conf) {
WSREP_DUMMY(w)->options = strdup(conf);
}
return WSREP_OK;
}
static char* dummy_options_get (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return NULL;
return WSREP_DUMMY(w)->options;
}
static wsrep_status_t dummy_connect(
......@@ -385,6 +401,7 @@ int wsrep_dummy_loader(wsrep_t* w)
// initialize private context
WSREP_DUMMY(w)->log_fn = NULL;
WSREP_DUMMY(w)->options = NULL;
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