summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2021-04-15 13:53:28 +0200
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2021-04-22 06:06:03 +0200
commit93fdf4af76a9ee9d92da5a5394b7d4857d41a320 (patch)
treee034dc946408bf529e7885737ea156f2625ada6c
parentfb96ac0a496f0665b3feca3cf85aeeedf4bd1e23 (diff)
downloadmariadb-git-93fdf4af76a9ee9d92da5a5394b7d4857d41a320.tar.gz
wsrep_mariabackup_sst script: removing extra blank lines
Removed extra blank lines, the random arrangement of which interferes with the search for errors when viewing the code + removed extra spaces at the ends of lines.
-rw-r--r--scripts/wsrep_sst_mariabackup.sh244
1 files changed, 110 insertions, 134 deletions
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 29c527d8ff3..0499b6c0678 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -111,7 +111,7 @@ timeit(){
local cmd="$@"
local x1 x2 took extcode
- if [[ $ttime -eq 1 ]];then
+ if [[ $ttime -eq 1 ]];then
x1=$(date +%s)
wsrep_log_info "Evaluating $cmd"
eval "$cmd"
@@ -120,7 +120,7 @@ timeit(){
took=$(( x2-x1 ))
wsrep_log_info "NOTE: $stage took $took seconds"
totime=$(( totime+took ))
- else
+ else
wsrep_log_info "Evaluating $cmd"
eval "$cmd"
extcode=$?
@@ -131,11 +131,11 @@ timeit(){
get_keys()
{
# $encrypt -eq 1 is for internal purposes only
- if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then
- return
+ if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then
+ return
fi
- if [[ $encrypt -eq 0 ]];then
+ if [[ $encrypt -eq 0 ]];then
if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html"
fi
@@ -175,18 +175,18 @@ get_keys()
get_transfer()
{
- if [[ -z $SST_PORT ]];then
+ if [[ -z $SST_PORT ]];then
TSST_PORT=4444
- else
+ else
TSST_PORT=$SST_PORT
fi
if [[ $tfmt == 'nc' ]];then
- wsrep_check_programs nc
-
+ wsrep_check_programs nc
wsrep_log_info "Using netcat as streamer"
+
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
- if nc -h 2>&1 | grep -q ncat;then
+ if nc -h 2>&1 | grep -q ncat;then
# Ncat
tcmd="nc -l ${TSST_PORT}"
elif nc -h 2>&1 | grep -qw -- '-d\>';then
@@ -215,9 +215,8 @@ get_transfer()
tcmd_extra=""
if nc -h 2>&1 | grep -qw -- -N; then
tcmd_extra+="-N"
- wsrep_log_info "Using nc -N"
+ wsrep_log_info "Using nc -N"
fi
-
# netcat doesn't understand [] around IPv6 address
if nc -h 2>&1 | grep -q ncat;then
# Ncat
@@ -235,7 +234,7 @@ get_transfer()
fi
else
tfmt='socat'
- wsrep_check_programs socat
+ wsrep_check_programs socat
wsrep_log_info "Using socat as streamer"
if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q "WITH_OPENSSL 1";then
@@ -243,9 +242,9 @@ get_transfer()
exit 2
fi
- if [[ $encrypt -eq 2 ]];then
+ if [[ $encrypt -eq 2 ]];then
wsrep_log_info "Using openssl based encryption with socat: with crt and pem"
- if [[ -z $tpem || -z $tcert ]];then
+ if [[ -z $tpem || -z $tcert ]];then
wsrep_log_error "Both PEM and CRT files required"
exit 22
fi
@@ -281,8 +280,7 @@ get_transfer()
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tpem},key=${tkey},cafile=${tcert}${sockopt}"
fi
fi
-
- else
+ else
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
else
@@ -290,7 +288,6 @@ get_transfer()
fi
fi
fi
-
}
parse_cnf()
@@ -302,7 +299,7 @@ parse_cnf()
# then grep for needed variable
# finally get the variable value (if variables has been specified multiple time use the last value only)
reval=$($MY_PRINT_DEFAULTS $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2- | tail -1)
- if [[ -z $reval ]];then
+ if [[ -z $reval ]];then
[[ -n $3 ]] && reval=$3
fi
echo $reval
@@ -312,7 +309,7 @@ get_footprint()
{
pushd $WSREP_SST_OPT_DATA 1>/dev/null
payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }')
- if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
+ if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then
# QuickLZ has around 50% compression ratio
# When compression/compaction used, the progress is only an approximate.
payload=$(( payload*1/2 ))
@@ -324,7 +321,6 @@ get_footprint()
adjust_progress()
{
-
if ! command -v pv >/dev/null;then
wsrep_log_error "pv not found in path: $PATH"
wsrep_log_error "Disabling all progress/rate-limiting"
@@ -334,16 +330,16 @@ adjust_progress()
return
fi
- if [[ -n $progress && $progress != '1' ]];then
- if [[ -e $progress ]];then
+ if [[ -n $progress && $progress != '1' ]];then
+ if [[ -e $progress ]];then
pcmd+=" 2>>$progress"
- else
+ else
pcmd+=" 2>$progress"
fi
- elif [[ -z $progress && -n $rlimit ]];then
+ elif [[ -z $progress && -n $rlimit ]];then
# When rlimit is non-zero
pcmd="pv -q"
- fi
+ fi
if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then
wsrep_log_info "Rate-limiting SST to $rlimit"
@@ -371,7 +367,7 @@ read_cnf()
scomp=$(parse_cnf sst compressor "")
sdecomp=$(parse_cnf sst decompressor "")
- # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
+ # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
if [[ -z $ealgo ]];then
ealgo=$(parse_cnf sst encrypt-algo "")
ekey=$(parse_cnf sst encrypt-key "")
@@ -391,13 +387,13 @@ read_cnf()
sstlogarchive=$(parse_cnf sst sst-log-archive 1)
sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir "/tmp/sst_log_archive")
- if [[ $speciald -eq 0 ]];then
+ if [[ $speciald -eq 0 ]];then
wsrep_log_error "sst-special-dirs equal to 0 is not supported, falling back to 1"
speciald=1
- fi
+ fi
- if [[ $ssyslog -ne -1 ]];then
- if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
+ if [[ $ssyslog -ne -1 ]];then
+ if $MY_PRINT_DEFAULTS mysqld_safe | tr '_' '-' | grep -q -- "--syslog";then
ssyslog=1
fi
fi
@@ -426,7 +422,6 @@ get_stream()
else
strmcmd="tar cf - \${INFO_FILE} "
fi
-
fi
}
@@ -448,33 +443,32 @@ cleanup_joiner()
{
# Since this is invoked just after exit NNN
local estatus=$?
- if [[ $estatus -ne 0 ]];then
+ if [[ $estatus -ne 0 ]];then
wsrep_log_error "Cleanup after exit with status:$estatus"
elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then
wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file
fi
- if [[ -n $progress && -p $progress ]];then
+ if [[ -n $progress && -p $progress ]];then
wsrep_log_info "Cleaning up fifo file $progress"
rm $progress
fi
- if [[ -n ${STATDIR:-} ]];then
+
+ if [[ -n ${STATDIR:-} ]];then
[[ -d $STATDIR ]] && rm -rf $STATDIR
fi
- # Final cleanup
+ # Final cleanup
pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
# This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise.
if [[ $$ -eq $pgid ]];then
-
# This means a signal was delivered to the process.
- # So, more cleanup.
- if [[ $estatus -ge 128 ]];then
+ # So, more cleanup.
+ if [[ $estatus -ge 128 ]];then
kill -KILL -$$ || true
fi
-
fi
exit $estatus
@@ -490,52 +484,49 @@ cleanup_donor()
{
# Since this is invoked just after exit NNN
local estatus=$?
- if [[ $estatus -ne 0 ]];then
+ if [[ $estatus -ne 0 ]];then
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
-
fi
+
rm -f ${DATA}/${IST_FILE} || true
- if [[ -n $progress && -p $progress ]];then
+ if [[ -n $progress && -p $progress ]];then
wsrep_log_info "Cleaning up fifo file $progress"
rm -f $progress || true
fi
wsrep_log_info "Cleaning up temporary directories"
- if [[ -n $xtmpdir ]];then
+ if [[ -n $xtmpdir ]];then
[[ -d $xtmpdir ]] && rm -rf $xtmpdir || true
fi
- if [[ -n $itmpdir ]];then
+ if [[ -n $itmpdir ]];then
[[ -d $itmpdir ]] && rm -rf $itmpdir || true
fi
- # Final cleanup
+ # Final cleanup
pgid=$(ps -o pgid= $$ | grep -o '[0-9]*')
# This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise.
if [[ $$ -eq $pgid ]];then
-
# This means a signal was delivered to the process.
- # So, more cleanup.
- if [[ $estatus -ge 128 ]];then
+ # So, more cleanup.
+ if [[ $estatus -ge 128 ]];then
kill -KILL -$$ || true
fi
-
fi
exit $estatus
-
}
kill_xtrabackup()
@@ -565,7 +556,7 @@ wait_for_listen()
local MODULE=$3
for i in {1..50}
do
- if [ "$OS" = "FreeBSD" ];then
+ if [ "$OS" = "FreeBSD" ];then
sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break
else
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
@@ -578,20 +569,20 @@ wait_for_listen()
check_extra()
{
local use_socket=1
- if [[ $uextra -eq 1 ]];then
- if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
+ if [[ $uextra -eq 1 ]];then
+ if $MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then
local eport=$($MY_PRINT_DEFAULTS --mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2)
- if [[ -n $eport ]];then
+ if [[ -n $eport ]];then
# Xtrabackup works only locally.
- # Hence, setting host to 127.0.0.1 unconditionally.
+ # Hence, setting host to 127.0.0.1 unconditionally.
wsrep_log_info "SST through extra_port $eport"
INNOEXTRA+=" --host=127.0.0.1 --port=$eport"
use_socket=0
- else
+ else
wsrep_log_error "Extra port $eport null, failing"
exit 1
fi
- else
+ else
wsrep_log_info "Thread pool not set, ignore the option use_extra"
fi
fi
@@ -603,7 +594,7 @@ check_extra()
recv_joiner()
{
local dir=$1
- local msg=$2
+ local msg=$2
local tmt=$3
local checkf=$4
local ltcmd
@@ -617,27 +608,27 @@ recv_joiner()
set +e
if [[ $tmt -gt 0 ]] && command -v timeout >/dev/null;then
- if timeout --help | grep -q -- '-k';then
+ if timeout --help | grep -q -- '-k';then
ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd"
- else
+ else
ltcmd="timeout -s9 $tmt $tcmd"
fi
timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
- else
+ else
timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )"
fi
set -e
- popd 1>/dev/null
+ popd 1>/dev/null
- if [[ ${RC[0]} -eq 124 ]];then
+ if [[ ${RC[0]} -eq 124 ]];then
wsrep_log_error "Possible timeout in receiving first data from "
- "donor in gtid stage: exit codes: ${RC[@]}"
+ "donor in gtid stage: exit codes: ${RC[@]}"
exit 32
fi
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
+ for ecode in "${RC[@]}";do
+ if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \
"exit codes: ${RC[@]}"
exit 32
@@ -647,33 +638,30 @@ recv_joiner()
if [[ $checkf -eq 1 && ! -r "${MAGIC_FILE}" ]];then
# this message should cause joiner to abort
wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'"
- wsrep_log_info "Contents of datadir"
+ wsrep_log_info "Contents of datadir"
wsrep_log_info "$(ls -l ${dir}/*)"
exit 32
fi
}
-
send_donor()
{
local dir=$1
- local msg=$2
+ local msg=$2
pushd ${dir} 1>/dev/null
set +e
timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )"
set -e
- popd 1>/dev/null
-
+ popd 1>/dev/null
- for ecode in "${RC[@]}";do
- if [[ $ecode -ne 0 ]];then
+ for ecode in "${RC[@]}";do
+ if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \
"exit codes: ${RC[@]}"
exit 32
fi
done
-
}
monitor_process()
@@ -681,18 +669,14 @@ monitor_process()
local sst_stream_pid=$1
while true ; do
-
if ! ps -p "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
- wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
+ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
exit 32
fi
-
if ! ps -p "${sst_stream_pid}" &>/dev/null; then
break
fi
-
sleep 0.1
-
done
}
@@ -700,7 +684,7 @@ wsrep_check_programs "$INNOBACKUPEX_BIN"
rm -f "${MAGIC_FILE}"
-if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
+if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}"
exit 22
fi
@@ -708,13 +692,13 @@ fi
read_cnf
setup_ports
-if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then
+if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then
disver="--no-version-check"
fi
iopts+=" --databases-exclude=\"lost+found\""
-if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
+if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL"
iopts+=" --no-backup-locks"
fi
@@ -746,24 +730,23 @@ else
INNODB_DATA_HOME_DIR=$(cd $DATA; pwd -P)
fi
-if [[ $ssyslog -eq 1 ]];then
+if [[ $ssyslog -eq 1 ]];then
if ! command -v logger >/dev/null;then
wsrep_log_error "logger not in path: $PATH. Ignoring"
else
-
wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog"
exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE)
wsrep_log_error()
{
- logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
+ logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
}
wsrep_log_info()
{
- logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
+ logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
}
INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA $rebuildcmd --target-dir=\${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply"
@@ -794,7 +777,6 @@ then
else
newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP}
fi
-
wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}"
mv "${INNOAPPLYLOG}" "${newfile}"
gzip "${newfile}"
@@ -827,12 +809,12 @@ then
mv "${INNOBACKUPLOG}" "${newfile}"
gzip "${newfile}"
fi
-
fi
-
+
INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA $rebuildcmd --target-dir=\${DATA} &> ${INNOAPPLYLOG}"
INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --move-back $disver $impts --force-non-empty-directories --target-dir=\${DATA} &> ${INNOMOVELOG}"
INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir 2> ${INNOBACKUPLOG}"
+
fi
get_stream
@@ -845,7 +827,7 @@ then
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
then
usrst=0
- if [[ -z $sst_ver ]];then
+ if [[ -z $sst_ver ]];then
wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support"
wsrep_log_error "The joiner is not supported for this version of donor"
exit 93
@@ -878,7 +860,7 @@ then
if [[ $encrypt -eq 1 ]];then
if [[ -n $ekey ]];then
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey"
- else
+ else
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile"
fi
fi
@@ -894,22 +876,22 @@ then
ttcmd="$tcmd"
if [[ $encrypt -eq 1 ]];then
- if [[ -n $scomp ]];then
+ if [[ -n $scomp ]];then
tcmd=" $ecmd | $scomp | $tcmd "
- else
+ else
tcmd=" $ecmd | $tcmd "
fi
- elif [[ -n $scomp ]];then
+ elif [[ -n $scomp ]];then
tcmd=" $scomp | $tcmd "
fi
send_donor $DATA "${stagemsg}-gtid"
tcmd="$ttcmd"
- if [[ -n $progress ]];then
+ if [[ -n $progress ]];then
get_footprint
tcmd="$pcmd | $tcmd"
- elif [[ -n $rlimit ]];then
+ elif [[ -n $rlimit ]];then
adjust_progress
tcmd="$pcmd | $tcmd"
fi
@@ -919,7 +901,7 @@ then
wsrep_log_info "Streaming the backup to joiner at ${REMOTEIP} ${SST_PORT:-4444}"
- if [[ -n $scomp ]];then
+ if [[ -n $scomp ]];then
tcmd="$scomp | $tcmd"
fi
@@ -931,7 +913,7 @@ then
wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \
"Check syslog or ${INNOBACKUPLOG} for details"
exit 22
- elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
+ elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then
wsrep_log_error "$tcmd finished with error: ${RC[1]}"
exit 22
fi
@@ -939,7 +921,6 @@ then
# innobackupex implicitly writes PID to fixed location in $xtmpdir
XTRABACKUP_PID="$xtmpdir/xtrabackup_pid"
-
else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST"
@@ -951,12 +932,12 @@ then
echo "1" > "${DATA}/${IST_FILE}"
get_keys
if [[ $encrypt -eq 1 ]];then
- if [[ -n $scomp ]];then
+ if [[ -n $scomp ]];then
tcmd=" $ecmd | $scomp | $tcmd "
else
tcmd=" $ecmd | $tcmd "
fi
- elif [[ -n $scomp ]];then
+ elif [[ -n $scomp ]];then
tcmd=" $scomp | $tcmd "
fi
strmcmd+=" \${IST_FILE}"
@@ -1003,7 +984,6 @@ then
stagemsg="Joiner-Recv"
-
sencrypted=1
nthreads=1
@@ -1030,30 +1010,29 @@ then
trap sig_joiner_cleanup HUP PIPE INT TERM
trap cleanup_joiner EXIT
- if [[ -n $progress ]];then
+ if [[ -n $progress ]];then
adjust_progress
tcmd+=" | $pcmd"
fi
get_keys
if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then
- if [[ -n $sdecomp ]];then
+ if [[ -n $sdecomp ]];then
strmcmd=" $sdecomp | $ecmd | $strmcmd"
- else
+ else
strmcmd=" $ecmd | $strmcmd"
fi
- elif [[ -n $sdecomp ]];then
+ elif [[ -n $sdecomp ]];then
strmcmd=" $sdecomp | $strmcmd"
fi
STATDIR=$(mktemp -d)
MAGIC_FILE="${STATDIR}/${INFO_FILE}"
- recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout 1
-
+ recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout 1
if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
then
- wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
+ wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
exit 32
fi
@@ -1070,11 +1049,11 @@ then
wsrep_log_info "Proceeding with SST"
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
- if [ "${OS}" = "FreeBSD" ]; then
+ if [ "${OS}" = "FreeBSD" ]; then
find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
else
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
- fi
+ fi
tempdir=$LOG_BIN_ARG
if [ -z "$tempdir" ]; then
@@ -1094,30 +1073,27 @@ then
fi
fi
-
-
TDATA=${DATA}
DATA="${DATA}/.sst"
-
MAGIC_FILE="${DATA}/${INFO_FILE}"
wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid
get_proc
- if [[ ! -s ${DATA}/xtrabackup_checkpoints ]];then
+ if [[ ! -s ${DATA}/xtrabackup_checkpoints ]];then
wsrep_log_error "xtrabackup_checkpoints missing, failed innobackupex/SST on donor"
exit 2
fi
# Rebuild indexes for compact backups
- if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then
+ if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then
wsrep_log_info "Index compaction detected"
rebuild=1
fi
- if [[ $rebuild -eq 1 ]];then
+ if [[ $rebuild -eq 1 ]];then
nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc)
wsrep_log_info "Rebuilding during prepare with $nthreads threads"
rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads"
@@ -1127,7 +1103,7 @@ then
wsrep_log_info "Compressed qpress files found"
- if ! command -v qpress >/dev/null;then
+ if ! command -v qpress >/dev/null;then
wsrep_log_error "qpress not found in path: $PATH"
exit 22
fi
@@ -1135,28 +1111,27 @@ then
if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then
count=$(find ${DATA} -type f -name '*.qp' | wc -l)
count=$(( count*2 ))
- if pv --help | grep -q FORMAT;then
+ if pv --help | grep -q FORMAT;then
pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'"
- else
+ else
pvopts="-f -s $count -l -N Decompression"
fi
pcmd="pv $pvopts"
adjust_progress
dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d"
- else
+ else
dcmd="xargs -n 2 qpress -T${nproc}d"
fi
-
- # Decompress the qpress files
+ # Decompress the qpress files
wsrep_log_info "Decompression with $nproc threads"
timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
extcode=$?
if [[ $extcode -eq 0 ]];then
wsrep_log_info "Removing qpress files after decompression"
- find ${DATA} -type f -name '*.qp' -delete
- if [[ $? -ne 0 ]];then
+ find ${DATA} -type f -name '*.qp' -delete
+ if [[ $? -ne 0 ]];then
wsrep_log_error "Something went wrong with deletion of qpress files. Investigate"
fi
else
@@ -1165,13 +1140,12 @@ then
fi
fi
-
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
- # To avoid comparing data directory and BINLOG_DIRNAME
+ # To avoid comparing data directory and BINLOG_DIRNAME
mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true
pushd $BINLOG_DIRNAME &>/dev/null
@@ -1187,7 +1161,7 @@ then
if [ $? -ne 0 ];
then
- wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check syslog or ${INNOAPPLYLOG} for details"
+ wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check syslog or ${INNOAPPLYLOG} for details"
exit 22
fi
@@ -1196,27 +1170,29 @@ then
set -e
wsrep_log_info "Moving the backup to ${TDATA}"
timeit "Xtrabackup move stage" "$INNOMOVE"
- if [[ $? -eq 0 ]];then
+ if [[ $? -eq 0 ]];then
wsrep_log_info "Move successful, removing ${DATA}"
rm -rf $DATA
DATA=${TDATA}
- else
+ else
wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis"
wsrep_log_error "Check syslog or ${INNOMOVELOG} for details"
exit 22
fi
+ else
- else
wsrep_log_info "${IST_FILE} received from donor: Running IST"
+
fi
- if [[ ! -r ${MAGIC_FILE} ]];then
+ if [[ ! -r ${MAGIC_FILE} ]];then
wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable"
exit 2
fi
wsrep_log_info "Galera co-ords from recovery: $(cat ${MAGIC_FILE})"
cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id
+
wsrep_log_info "Total time on joiner: $totime seconds"
fi