mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
wsrep sst scripts: removing extra blank lines and spaces
Removed numerous extra blank lines and spaces that interfere with reading and understanding program code, making it more difficult to find errors in scripts. I also removed all extra trailing spaces at the ends of lines, which lead to marking extra lines as changes (in subsequent changes). The amount of indentation in some parts of the code has also been normalized.
This commit is contained in:
@ -183,8 +183,8 @@ get_transfer()
|
||||
|
||||
if [[ $tfmt == 'nc' ]];then
|
||||
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
|
||||
# Ncat
|
||||
@ -217,7 +217,6 @@ get_transfer()
|
||||
tcmd_extra+="-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
|
||||
@ -281,7 +280,6 @@ get_transfer()
|
||||
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tpem},key=${tkey},cafile=${tcert}${sockopt}"
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
|
||||
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
|
||||
@ -290,7 +288,6 @@ get_transfer()
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
parse_cnf()
|
||||
@ -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"
|
||||
@ -426,7 +422,6 @@ get_stream()
|
||||
else
|
||||
strmcmd="tar cf - \${INFO_FILE} "
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
@ -458,6 +453,7 @@ cleanup_joiner()
|
||||
wsrep_log_info "Cleaning up fifo file $progress"
|
||||
rm $progress
|
||||
fi
|
||||
|
||||
if [[ -n ${STATDIR:-} ]];then
|
||||
[[ -d $STATDIR ]] && rm -rf $STATDIR
|
||||
fi
|
||||
@ -468,13 +464,11 @@ cleanup_joiner()
|
||||
# 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
|
||||
kill -KILL -$$ || true
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exit $estatus
|
||||
@ -500,8 +494,8 @@ cleanup_donor()
|
||||
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
|
||||
@ -525,17 +519,14 @@ cleanup_donor()
|
||||
# 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
|
||||
kill -KILL -$$ || true
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exit $estatus
|
||||
|
||||
}
|
||||
|
||||
kill_xtrabackup()
|
||||
@ -653,7 +644,6 @@ recv_joiner()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
send_donor()
|
||||
{
|
||||
local dir=$1
|
||||
@ -665,7 +655,6 @@ send_donor()
|
||||
set -e
|
||||
popd 1>/dev/null
|
||||
|
||||
|
||||
for ecode in "${RC[@]}";do
|
||||
if [[ $ecode -ne 0 ]];then
|
||||
wsrep_log_error "Error while getting data from donor node: " \
|
||||
@ -673,7 +662,6 @@ send_donor()
|
||||
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."
|
||||
exit 32
|
||||
fi
|
||||
|
||||
if ! ps -p "${sst_stream_pid}" &>/dev/null; then
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 0.1
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
@ -751,7 +735,6 @@ 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)
|
||||
@ -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
|
||||
@ -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"
|
||||
@ -1003,7 +984,6 @@ then
|
||||
|
||||
stagemsg="Joiner-Recv"
|
||||
|
||||
|
||||
sencrypted=1
|
||||
nthreads=1
|
||||
|
||||
@ -1050,7 +1030,6 @@ then
|
||||
MAGIC_FILE="${STATDIR}/${INFO_FILE}"
|
||||
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."
|
||||
@ -1094,12 +1073,9 @@ 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
|
||||
@ -1147,7 +1123,6 @@ then
|
||||
dcmd="xargs -n 2 qpress -T${nproc}d"
|
||||
fi
|
||||
|
||||
|
||||
# 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"
|
||||
@ -1165,7 +1140,6 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
|
||||
|
||||
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
|
||||
@ -1206,9 +1180,10 @@ then
|
||||
exit 22
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
|
||||
wsrep_log_info "${IST_FILE} received from donor: Running IST"
|
||||
|
||||
fi
|
||||
|
||||
if [[ ! -r ${MAGIC_FILE} ]];then
|
||||
@ -1217,6 +1192,7 @@ then
|
||||
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
|
||||
|
||||
|
@ -373,11 +373,13 @@ EOF
|
||||
fi
|
||||
|
||||
else # BYPASS
|
||||
|
||||
wsrep_log_info "Bypassing state dump."
|
||||
|
||||
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
|
||||
# (separated by a space).
|
||||
STATE="$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID"
|
||||
|
||||
fi
|
||||
|
||||
echo "continue" # now server can resume updating data
|
||||
@ -518,7 +520,6 @@ EOF
|
||||
|
||||
if ! [ -z $WSREP_SST_OPT_BINLOG ]
|
||||
then
|
||||
|
||||
OLD_PWD="$(pwd)"
|
||||
cd $BINLOG_DIRNAME
|
||||
|
||||
@ -537,9 +538,10 @@ EOF
|
||||
fi
|
||||
done
|
||||
fi
|
||||
cd "$OLD_PWD"
|
||||
|
||||
cd "$OLD_PWD"
|
||||
fi
|
||||
|
||||
if [ -r "$MAGIC_FILE" ]
|
||||
then
|
||||
# UUID:seqno & wsrep_gtid_domain_id is received here.
|
||||
@ -548,6 +550,7 @@ EOF
|
||||
# this message should cause joiner to abort
|
||||
echo "rsync process ended without creating '$MAGIC_FILE'"
|
||||
fi
|
||||
|
||||
wsrep_cleanup_progress_file
|
||||
# cleanup_joiner
|
||||
else
|
||||
|
@ -18,9 +18,6 @@
|
||||
# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
|
||||
# Make sure to read that before proceeding!
|
||||
|
||||
|
||||
|
||||
|
||||
. $(dirname $0)/wsrep_sst_common
|
||||
|
||||
ealgo=""
|
||||
@ -389,7 +386,6 @@ get_transfer()
|
||||
wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca"
|
||||
tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}"
|
||||
fi
|
||||
|
||||
else
|
||||
if [[ $encrypt -eq 1 ]]; then
|
||||
wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release"
|
||||
@ -420,7 +416,6 @@ get_footprint()
|
||||
|
||||
adjust_progress()
|
||||
{
|
||||
|
||||
if [[ ! -x `which pv` ]];then
|
||||
wsrep_log_error "pv not found in path: $PATH"
|
||||
wsrep_log_error "Disabling all progress/rate-limiting"
|
||||
@ -470,7 +465,6 @@ 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
|
||||
if [[ -z $ealgo ]];then
|
||||
ealgo=$(parse_cnf sst encrypt-algo "")
|
||||
@ -526,7 +520,6 @@ get_stream()
|
||||
else
|
||||
strmcmd="tar cf - \${INFO_FILE} "
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
@ -558,6 +551,7 @@ cleanup_joiner()
|
||||
wsrep_log_info "Cleaning up fifo file $progress"
|
||||
rm $progress
|
||||
fi
|
||||
|
||||
if [[ -n ${STATDIR:-} ]];then
|
||||
[[ -d $STATDIR ]] && rm -rf $STATDIR
|
||||
fi
|
||||
@ -568,13 +562,11 @@ cleanup_joiner()
|
||||
# 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
|
||||
kill -KILL -$$ || true
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exit $estatus
|
||||
@ -602,6 +594,7 @@ cleanup_donor()
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
rm -f ${DATA}/${IST_FILE} || true
|
||||
|
||||
if [[ -n $progress && -p $progress ]];then
|
||||
@ -635,7 +628,6 @@ cleanup_donor()
|
||||
fi
|
||||
|
||||
exit $estatus
|
||||
|
||||
}
|
||||
|
||||
kill_xtrabackup()
|
||||
@ -742,7 +734,6 @@ recv_joiner()
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
send_donor()
|
||||
{
|
||||
local dir=$1
|
||||
@ -754,7 +745,6 @@ send_donor()
|
||||
set -e
|
||||
popd 1>/dev/null
|
||||
|
||||
|
||||
for ecode in "${RC[@]}";do
|
||||
if [[ $ecode -ne 0 ]];then
|
||||
wsrep_log_error "Error while getting data from donor node: " \
|
||||
@ -762,7 +752,6 @@ send_donor()
|
||||
exit 32
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
# Returns the version string in a standardized format
|
||||
@ -822,7 +811,6 @@ monitor_process()
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
|
||||
wsrep_log_error "innobackupex not in path: $PATH"
|
||||
exit 2
|
||||
@ -843,7 +831,6 @@ if ! check_for_version $XB_VERSION $XB_REQUIRED_VERSION; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
rm -f "${MAGIC_FILE}"
|
||||
|
||||
if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then
|
||||
@ -862,7 +849,6 @@ if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
|
||||
iopts+=" --no-backup-locks "
|
||||
fi
|
||||
|
||||
|
||||
INNOEXTRA=""
|
||||
|
||||
if [[ $ssyslog -eq 1 ]];then
|
||||
@ -870,7 +856,6 @@ if [[ $ssyslog -eq 1 ]];then
|
||||
if [[ ! -x `which logger` ]];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)
|
||||
@ -1028,7 +1013,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"
|
||||
@ -1119,7 +1103,6 @@ then
|
||||
MAGIC_FILE="${STATDIR}/${INFO_FILE}"
|
||||
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."
|
||||
@ -1138,7 +1121,6 @@ then
|
||||
jpid=$!
|
||||
wsrep_log_info "Proceeding with SST"
|
||||
|
||||
|
||||
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
|
||||
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 \+
|
||||
@ -1164,12 +1146,9 @@ 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
|
||||
@ -1217,7 +1196,6 @@ then
|
||||
dcmd="xargs -n 2 qpress -T${nproc}d"
|
||||
fi
|
||||
|
||||
|
||||
# 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"
|
||||
@ -1235,7 +1213,6 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
|
||||
|
||||
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
|
||||
@ -1277,7 +1254,6 @@ then
|
||||
exit 22
|
||||
fi
|
||||
|
||||
|
||||
else
|
||||
wsrep_log_info "${IST_FILE} received from donor: Running IST"
|
||||
fi
|
||||
|
@ -18,9 +18,6 @@
|
||||
# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
|
||||
# Make sure to read that before proceeding!
|
||||
|
||||
|
||||
|
||||
|
||||
. $(dirname $0)/wsrep_sst_common
|
||||
|
||||
ealgo=""
|
||||
@ -199,7 +196,6 @@ get_transfer()
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_footprint()
|
||||
@ -278,7 +274,6 @@ get_stream()
|
||||
else
|
||||
strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}"
|
||||
fi
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
@ -333,9 +328,9 @@ cleanup_donor()
|
||||
wsrep_log_error "xtrabackup process is still running. Killing... "
|
||||
kill_xtrabackup
|
||||
fi
|
||||
|
||||
rm -f $XTRABACKUP_PID
|
||||
fi
|
||||
|
||||
rm -f ${DATA}/${IST_FILE}
|
||||
|
||||
if [[ -n $progress && -p $progress ]];then
|
||||
@ -503,6 +498,7 @@ then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
echo "done ${WSREP_SST_OPT_GTID}"
|
||||
@ -600,6 +596,7 @@ then
|
||||
if [ ! -r "${DATA}/${IST_FILE}" ]
|
||||
then
|
||||
wsrep_log_info "Proceeding with SST"
|
||||
|
||||
wsrep_log_info "Removing existing ib_logfile files"
|
||||
if [[ $incremental -ne 1 ]];then
|
||||
rm -f ${DATA}/ib_logfile*
|
||||
|
Reference in New Issue
Block a user