1
0
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:
Julius Goryavsky
2021-04-15 13:53:28 +02:00
parent 562c88257f
commit e0324bf300
6 changed files with 329 additions and 377 deletions

View File

@ -194,9 +194,9 @@ case "$1" in
shift shift
;; ;;
'--binlog-index') '--binlog-index')
WSREP_SST_OPT_BINLOG_INDEX="$2" WSREP_SST_OPT_BINLOG_INDEX="$2"
shift shift
;; ;;
'--gtid-domain-id') '--gtid-domain-id')
readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2" readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2"
shift shift
@ -298,11 +298,11 @@ fi
wsrep_defaults="$WSREP_SST_OPT_DEFAULT" wsrep_defaults="$WSREP_SST_OPT_DEFAULT"
if [ -n "$wsrep_defaults" ]; then if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults " wsrep_defaults="$wsrep_defaults "
fi fi
wsrep_defaults="$wsrep_defaults$WSREP_SST_OPT_EXTRA_DEFAULT" wsrep_defaults="$wsrep_defaults$WSREP_SST_OPT_EXTRA_DEFAULT"
if [ -n "$wsrep_defaults" ]; then if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults " wsrep_defaults="$wsrep_defaults "
fi fi
readonly WSREP_SST_OPT_CONF="$wsrep_defaults$WSREP_SST_OPT_SUFFIX_DEFAULT" readonly WSREP_SST_OPT_CONF="$wsrep_defaults$WSREP_SST_OPT_SUFFIX_DEFAULT"
readonly MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF" readonly MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF"

View File

@ -87,8 +87,8 @@ set +e
INNOBACKUPEX_BIN=$(which mariabackup) INNOBACKUPEX_BIN=$(which mariabackup)
if test -z $INNOBACKUPEX_BIN if test -z $INNOBACKUPEX_BIN
then then
wsrep_log_error 'mariabackup binary not found in $PATH' wsrep_log_error 'mariabackup binary not found in $PATH'
exit 42 exit 42
fi fi
set -e set -e
XBSTREAM_BIN=mbstream XBSTREAM_BIN=mbstream
@ -182,9 +182,9 @@ get_transfer()
fi fi
if [[ $tfmt == 'nc' ]];then if [[ $tfmt == 'nc' ]];then
wsrep_check_programs nc wsrep_check_programs nc
wsrep_log_info "Using netcat as streamer" wsrep_log_info "Using netcat as streamer"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then 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 # Ncat
@ -215,9 +215,8 @@ get_transfer()
tcmd_extra="" tcmd_extra=""
if nc -h 2>&1 | grep -qw -- -N; then if nc -h 2>&1 | grep -qw -- -N; then
tcmd_extra+="-N" tcmd_extra+="-N"
wsrep_log_info "Using nc -N" wsrep_log_info "Using nc -N"
fi fi
# netcat doesn't understand [] around IPv6 address # netcat doesn't understand [] around IPv6 address
if nc -h 2>&1 | grep -q ncat;then if nc -h 2>&1 | grep -q ncat;then
# Ncat # Ncat
@ -235,7 +234,7 @@ get_transfer()
fi fi
else else
tfmt='socat' tfmt='socat'
wsrep_check_programs socat wsrep_check_programs socat
wsrep_log_info "Using socat as streamer" wsrep_log_info "Using socat as streamer"
if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q "WITH_OPENSSL 1";then if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q "WITH_OPENSSL 1";then
@ -281,7 +280,6 @@ get_transfer()
tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tpem},key=${tkey},cafile=${tcert}${sockopt}" tcmd="socat -u stdio openssl-connect:${REMOTEIP}:${TSST_PORT},cert=${tpem},key=${tkey},cafile=${tcert}${sockopt}"
fi fi
fi fi
else else
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio"
@ -290,7 +288,6 @@ get_transfer()
fi fi
fi fi
fi fi
} }
parse_cnf() parse_cnf()
@ -324,7 +321,6 @@ get_footprint()
adjust_progress() adjust_progress()
{ {
if ! command -v pv >/dev/null;then if ! command -v pv >/dev/null;then
wsrep_log_error "pv not found in path: $PATH" wsrep_log_error "pv not found in path: $PATH"
wsrep_log_error "Disabling all progress/rate-limiting" wsrep_log_error "Disabling all progress/rate-limiting"
@ -426,7 +422,6 @@ get_stream()
else else
strmcmd="tar cf - \${INFO_FILE} " strmcmd="tar cf - \${INFO_FILE} "
fi fi
fi fi
} }
@ -458,6 +453,7 @@ cleanup_joiner()
wsrep_log_info "Cleaning up fifo file $progress" wsrep_log_info "Cleaning up fifo file $progress"
rm $progress rm $progress
fi fi
if [[ -n ${STATDIR:-} ]];then if [[ -n ${STATDIR:-} ]];then
[[ -d $STATDIR ]] && rm -rf $STATDIR [[ -d $STATDIR ]] && rm -rf $STATDIR
fi fi
@ -468,13 +464,11 @@ cleanup_joiner()
# This means no setsid done in mysqld. # This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise. # We don't want to kill mysqld here otherwise.
if [[ $$ -eq $pgid ]];then if [[ $$ -eq $pgid ]];then
# This means a signal was delivered to the process. # This means a signal was delivered to the process.
# So, more cleanup. # So, more cleanup.
if [[ $estatus -ge 128 ]];then if [[ $estatus -ge 128 ]];then
kill -KILL -$$ || true kill -KILL -$$ || true
fi fi
fi fi
exit $estatus exit $estatus
@ -500,8 +494,8 @@ cleanup_donor()
wsrep_log_error "xtrabackup process is still running. Killing..." wsrep_log_error "xtrabackup process is still running. Killing..."
kill_xtrabackup kill_xtrabackup
fi fi
fi fi
rm -f ${DATA}/${IST_FILE} || true rm -f ${DATA}/${IST_FILE} || true
if [[ -n $progress && -p $progress ]];then if [[ -n $progress && -p $progress ]];then
@ -525,17 +519,14 @@ cleanup_donor()
# This means no setsid done in mysqld. # This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise. # We don't want to kill mysqld here otherwise.
if [[ $$ -eq $pgid ]];then if [[ $$ -eq $pgid ]];then
# This means a signal was delivered to the process. # This means a signal was delivered to the process.
# So, more cleanup. # So, more cleanup.
if [[ $estatus -ge 128 ]];then if [[ $estatus -ge 128 ]];then
kill -KILL -$$ || true kill -KILL -$$ || true
fi fi
fi fi
exit $estatus exit $estatus
} }
kill_xtrabackup() kill_xtrabackup()
@ -565,7 +556,7 @@ wait_for_listen()
local MODULE=$3 local MODULE=$3
for i in {1..50} for i in {1..50}
do do
if [ "$OS" = "FreeBSD" ];then if [ "$OS" = "FreeBSD" ];then
sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break
else else
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
@ -632,7 +623,7 @@ recv_joiner()
if [[ ${RC[0]} -eq 124 ]];then if [[ ${RC[0]} -eq 124 ]];then
wsrep_log_error "Possible timeout in receiving first data from " 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 exit 32
fi fi
@ -653,7 +644,6 @@ recv_joiner()
fi fi
} }
send_donor() send_donor()
{ {
local dir=$1 local dir=$1
@ -665,7 +655,6 @@ send_donor()
set -e set -e
popd 1>/dev/null popd 1>/dev/null
for ecode in "${RC[@]}";do for ecode in "${RC[@]}";do
if [[ $ecode -ne 0 ]];then if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \ wsrep_log_error "Error while getting data from donor node: " \
@ -673,7 +662,6 @@ send_donor()
exit 32 exit 32
fi fi
done done
} }
monitor_process() monitor_process()
@ -681,18 +669,14 @@ monitor_process()
local sst_stream_pid=$1 local sst_stream_pid=$1
while true ; do while true ; do
if ! ps -p "${WSREP_SST_OPT_PARENT}" &>/dev/null; then 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 exit 32
fi fi
if ! ps -p "${sst_stream_pid}" &>/dev/null; then if ! ps -p "${sst_stream_pid}" &>/dev/null; then
break break
fi fi
sleep 0.1 sleep 0.1
done done
} }
@ -751,7 +735,6 @@ if [[ $ssyslog -eq 1 ]];then
if ! command -v logger >/dev/null;then if ! command -v logger >/dev/null;then
wsrep_log_error "logger not in path: $PATH. Ignoring" wsrep_log_error "logger not in path: $PATH. Ignoring"
else else
wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog" 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) exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE)
@ -794,7 +777,6 @@ then
else else
newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP} newfile=${INNOAPPLYLOG}.${ARCHIVETIMESTAMP}
fi fi
wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}" wsrep_log_info "Moving ${INNOAPPLYLOG} to ${newfile}"
mv "${INNOAPPLYLOG}" "${newfile}" mv "${INNOAPPLYLOG}" "${newfile}"
gzip "${newfile}" gzip "${newfile}"
@ -827,12 +809,12 @@ then
mv "${INNOBACKUPLOG}" "${newfile}" mv "${INNOBACKUPLOG}" "${newfile}"
gzip "${newfile}" gzip "${newfile}"
fi fi
fi fi
INNOAPPLY="${INNOBACKUPEX_BIN} --prepare $disver $iapts \$INNOEXTRA $rebuildcmd --target-dir=\${DATA} &> ${INNOAPPLYLOG}" 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}" 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}" INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --backup $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt --target-dir=\$itmpdir 2> ${INNOBACKUPLOG}"
fi fi
get_stream get_stream
@ -939,7 +921,6 @@ then
# innobackupex implicitly writes PID to fixed location in $xtmpdir # innobackupex implicitly writes PID to fixed location in $xtmpdir
XTRABACKUP_PID="$xtmpdir/xtrabackup_pid" XTRABACKUP_PID="$xtmpdir/xtrabackup_pid"
else # BYPASS FOR IST else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST" wsrep_log_info "Bypassing the SST for IST"
@ -1003,7 +984,6 @@ then
stagemsg="Joiner-Recv" stagemsg="Joiner-Recv"
sencrypted=1 sencrypted=1
nthreads=1 nthreads=1
@ -1048,8 +1028,7 @@ then
STATDIR=$(mktemp -d) STATDIR=$(mktemp -d)
MAGIC_FILE="${STATDIR}/${INFO_FILE}" 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 if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
then then
@ -1070,11 +1049,11 @@ then
wsrep_log_info "Proceeding with SST" wsrep_log_info "Proceeding with SST"
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" 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 \+ find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
else else
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ 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 tempdir=$LOG_BIN_ARG
if [ -z "$tempdir" ]; then if [ -z "$tempdir" ]; then
@ -1094,12 +1073,9 @@ then
fi fi
fi fi
TDATA=${DATA} TDATA=${DATA}
DATA="${DATA}/.sst" DATA="${DATA}/.sst"
MAGIC_FILE="${DATA}/${INFO_FILE}" MAGIC_FILE="${DATA}/${INFO_FILE}"
wsrep_log_info "Waiting for SST streaming to complete!" wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid monitor_process $jpid
@ -1127,7 +1103,7 @@ then
wsrep_log_info "Compressed qpress files found" 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" wsrep_log_error "qpress not found in path: $PATH"
exit 22 exit 22
fi fi
@ -1147,7 +1123,6 @@ then
dcmd="xargs -n 2 qpress -T${nproc}d" dcmd="xargs -n 2 qpress -T${nproc}d"
fi fi
# Decompress the qpress files # Decompress the qpress files
wsrep_log_info "Decompression with $nproc threads" wsrep_log_info "Decompression with $nproc threads"
timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
@ -1165,7 +1140,6 @@ then
fi fi
fi fi
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
@ -1206,9 +1180,10 @@ then
exit 22 exit 22
fi fi
else else
wsrep_log_info "${IST_FILE} received from donor: Running IST" wsrep_log_info "${IST_FILE} received from donor: Running IST"
fi fi
if [[ ! -r ${MAGIC_FILE} ]];then if [[ ! -r ${MAGIC_FILE} ]];then
@ -1217,6 +1192,7 @@ then
fi fi
wsrep_log_info "Galera co-ords from recovery: $(cat ${MAGIC_FILE})" wsrep_log_info "Galera co-ords from recovery: $(cat ${MAGIC_FILE})"
cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id
wsrep_log_info "Total time on joiner: $totime seconds" wsrep_log_info "Total time on joiner: $totime seconds"
fi fi

View File

@ -100,12 +100,12 @@ SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';"
SET_WSREP_GTID_DOMAIN_ID="" SET_WSREP_GTID_DOMAIN_ID=""
if [ -n $WSREP_SST_OPT_GTID_DOMAIN_ID ] if [ -n $WSREP_SST_OPT_GTID_DOMAIN_ID ]
then then
SET_WSREP_GTID_DOMAIN_ID=" SET_WSREP_GTID_DOMAIN_ID="
SET @val = (SELECT GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME = 'WSREP_GTID_STRICT_MODE' AND GLOBAL_VALUE > 0); SET @val = (SELECT GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME = 'WSREP_GTID_STRICT_MODE' AND GLOBAL_VALUE > 0);
SET @stmt = IF (@val IS NOT NULL, 'SET GLOBAL WSREP_GTID_DOMAIN_ID=$WSREP_SST_OPT_GTID_DOMAIN_ID', 'SET @dummy = 0'); SET @stmt = IF (@val IS NOT NULL, 'SET GLOBAL WSREP_GTID_DOMAIN_ID=$WSREP_SST_OPT_GTID_DOMAIN_ID', 'SET @dummy = 0');
PREPARE stmt FROM @stmt; PREPARE stmt FROM @stmt;
EXECUTE stmt; EXECUTE stmt;
DROP PREPARE stmt;" DROP PREPARE stmt;"
fi fi
MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\ MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\
@ -132,16 +132,16 @@ SQL_LOG_BIN_OFF=""
# Safety check # Safety check
if [ "${SERVER_VERSION%%.*}" != '5' ] if [ "${SERVER_VERSION%%.*}" != '5' ]
then then
# If binary logging is enabled on the joiner node, we need to copy donor's # If binary logging is enabled on the joiner node, we need to copy donor's
# gtid_binlog_state to joiner. In order to do that, a RESET MASTER must be # gtid_binlog_state to joiner. In order to do that, a RESET MASTER must be
# executed to erase binary logs (if any). Binary logging should also be # executed to erase binary logs (if any). Binary logging should also be
# turned off for the session so that gtid state does not get altered while # turned off for the session so that gtid state does not get altered while
# the dump gets replayed on joiner. # the dump gets replayed on joiner.
if [[ "$LOG_BIN" == 'ON' ]]; then if [[ "$LOG_BIN" == 'ON' ]]; then
RESET_MASTER="RESET MASTER;" RESET_MASTER="RESET MASTER;"
SET_GTID_BINLOG_STATE="SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE';" SET_GTID_BINLOG_STATE="SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE';"
SQL_LOG_BIN_OFF="SET @@session.sql_log_bin=OFF;" SQL_LOG_BIN_OFF="SET @@session.sql_log_bin=OFF;"
fi fi
fi fi
# NOTE: we don't use --routines here because we're dumping mysql.proc table # NOTE: we don't use --routines here because we're dumping mysql.proc table

View File

@ -74,8 +74,8 @@ check_pid_and_port()
;; ;;
*) *)
if ! which lsof > /dev/null; then if ! which lsof > /dev/null; then
wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
exit 2 # ENOENT exit 2 # ENOENT
fi fi
local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \ local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \
@ -107,15 +107,15 @@ is_local_ip()
local get_addr_bin=`which ifconfig` local get_addr_bin=`which ifconfig`
if [ -z "$get_addr_bin" ] if [ -z "$get_addr_bin" ]
then then
get_addr_bin=`which ip` get_addr_bin=`which ip`
get_addr_bin="$get_addr_bin address show" get_addr_bin="$get_addr_bin address show"
# Add an slash at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 # Add an slash at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41
# ip output format is "X.X.X.X/mask" # ip output format is "X.X.X.X/mask"
address="${address}/" address="${address}/"
else else
# Add an space at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 # Add an space at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41
# ifconfig output format is "X.X.X.X " # ifconfig output format is "X.X.X.X "
address="$address " address="$address "
fi fi
$get_addr_bin | grep -F "$address" > /dev/null $get_addr_bin | grep -F "$address" > /dev/null
@ -373,11 +373,13 @@ EOF
fi fi
else # BYPASS else # BYPASS
wsrep_log_info "Bypassing state dump." wsrep_log_info "Bypassing state dump."
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space). # (separated by a space).
STATE="$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" STATE="$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID"
fi fi
echo "continue" # now server can resume updating data echo "continue" # now server can resume updating data
@ -461,22 +463,22 @@ EOF
# If the IP is local listen only in it # If the IP is local listen only in it
if is_local_ip "$RSYNC_ADDR" if is_local_ip "$RSYNC_ADDR"
then then
RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR" RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR"
STUNNEL_ACCEPT="$RSYNC_ADDR:$RSYNC_PORT" STUNNEL_ACCEPT="$RSYNC_ADDR:$RSYNC_PORT"
else else
# Not local, possibly a NAT, listen on all interfaces # Not local, possibly a NAT, listen on all interfaces
RSYNC_EXTRA_ARGS="" RSYNC_EXTRA_ARGS=""
STUNNEL_ACCEPT="$RSYNC_PORT" STUNNEL_ACCEPT="$RSYNC_PORT"
# Overwrite address with all # Overwrite address with all
RSYNC_ADDR="*" RSYNC_ADDR="*"
fi fi
if [ -z "$STUNNEL" ] if [ -z "$STUNNEL" ]
then then
rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" ${RSYNC_EXTRA_ARGS} & rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" ${RSYNC_EXTRA_ARGS} &
RSYNC_REAL_PID=$! RSYNC_REAL_PID=$!
else else
cat << EOF > "$STUNNEL_CONF" cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY key = $SSTKEY
cert = $SSTCERT cert = $SSTCERT
foreground = yes foreground = yes
@ -488,9 +490,9 @@ accept = $STUNNEL_ACCEPT
exec = $(which rsync) exec = $(which rsync)
execargs = rsync --server --daemon --config=$RSYNC_CONF . execargs = rsync --server --daemon --config=$RSYNC_CONF .
EOF EOF
stunnel "$STUNNEL_CONF" & stunnel "$STUNNEL_CONF" &
RSYNC_REAL_PID=$! RSYNC_REAL_PID=$!
RSYNC_PID=$STUNNEL_PID RSYNC_PID=$STUNNEL_PID
fi fi
until check_pid_and_port "$RSYNC_PID" "$RSYNC_REAL_PID" "$RSYNC_ADDR" "$RSYNC_PORT" until check_pid_and_port "$RSYNC_PID" "$RSYNC_REAL_PID" "$RSYNC_ADDR" "$RSYNC_PORT"
@ -518,7 +520,6 @@ EOF
if ! [ -z $WSREP_SST_OPT_BINLOG ] if ! [ -z $WSREP_SST_OPT_BINLOG ]
then then
OLD_PWD="$(pwd)" OLD_PWD="$(pwd)"
cd $BINLOG_DIRNAME cd $BINLOG_DIRNAME
@ -532,14 +533,15 @@ EOF
do do
if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ] if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
then then
echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
fi fi
done done
fi fi
cd "$OLD_PWD"
cd "$OLD_PWD"
fi fi
if [ -r "$MAGIC_FILE" ] if [ -r "$MAGIC_FILE" ]
then then
# UUID:seqno & wsrep_gtid_domain_id is received here. # UUID:seqno & wsrep_gtid_domain_id is received here.
@ -548,6 +550,7 @@ EOF
# this message should cause joiner to abort # this message should cause joiner to abort
echo "rsync process ended without creating '$MAGIC_FILE'" echo "rsync process ended without creating '$MAGIC_FILE'"
fi fi
wsrep_cleanup_progress_file wsrep_cleanup_progress_file
# cleanup_joiner # cleanup_joiner
else else

View File

@ -18,9 +18,6 @@
# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html # Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
# Make sure to read that before proceeding! # Make sure to read that before proceeding!
. $(dirname $0)/wsrep_sst_common . $(dirname $0)/wsrep_sst_common
ealgo="" ealgo=""
@ -389,7 +386,6 @@ get_transfer()
wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca" 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}" 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 fi
else else
if [[ $encrypt -eq 1 ]]; then if [[ $encrypt -eq 1 ]]; then
wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release" wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release"
@ -420,7 +416,6 @@ get_footprint()
adjust_progress() adjust_progress()
{ {
if [[ ! -x `which pv` ]];then if [[ ! -x `which pv` ]];then
wsrep_log_error "pv not found in path: $PATH" wsrep_log_error "pv not found in path: $PATH"
wsrep_log_error "Disabling all progress/rate-limiting" wsrep_log_error "Disabling all progress/rate-limiting"
@ -470,7 +465,6 @@ read_cnf()
scomp=$(parse_cnf sst compressor "") scomp=$(parse_cnf sst compressor "")
sdecomp=$(parse_cnf sst decompressor "") 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 if [[ -z $ealgo ]];then
ealgo=$(parse_cnf sst encrypt-algo "") ealgo=$(parse_cnf sst encrypt-algo "")
@ -526,7 +520,6 @@ get_stream()
else else
strmcmd="tar cf - \${INFO_FILE} " strmcmd="tar cf - \${INFO_FILE} "
fi fi
fi fi
} }
@ -558,6 +551,7 @@ cleanup_joiner()
wsrep_log_info "Cleaning up fifo file $progress" wsrep_log_info "Cleaning up fifo file $progress"
rm $progress rm $progress
fi fi
if [[ -n ${STATDIR:-} ]];then if [[ -n ${STATDIR:-} ]];then
[[ -d $STATDIR ]] && rm -rf $STATDIR [[ -d $STATDIR ]] && rm -rf $STATDIR
fi fi
@ -568,13 +562,11 @@ cleanup_joiner()
# This means no setsid done in mysqld. # This means no setsid done in mysqld.
# We don't want to kill mysqld here otherwise. # We don't want to kill mysqld here otherwise.
if [[ $$ -eq $pgid ]];then if [[ $$ -eq $pgid ]];then
# This means a signal was delivered to the process. # This means a signal was delivered to the process.
# So, more cleanup. # So, more cleanup.
if [[ $estatus -ge 128 ]];then if [[ $estatus -ge 128 ]];then
kill -KILL -$$ || true kill -KILL -$$ || true
fi fi
fi fi
exit $estatus exit $estatus
@ -602,6 +594,7 @@ cleanup_donor()
fi fi
fi fi
rm -f ${DATA}/${IST_FILE} || true rm -f ${DATA}/${IST_FILE} || true
if [[ -n $progress && -p $progress ]];then if [[ -n $progress && -p $progress ]];then
@ -635,7 +628,6 @@ cleanup_donor()
fi fi
exit $estatus exit $estatus
} }
kill_xtrabackup() kill_xtrabackup()
@ -742,7 +734,6 @@ recv_joiner()
fi fi
} }
send_donor() send_donor()
{ {
local dir=$1 local dir=$1
@ -754,7 +745,6 @@ send_donor()
set -e set -e
popd 1>/dev/null popd 1>/dev/null
for ecode in "${RC[@]}";do for ecode in "${RC[@]}";do
if [[ $ecode -ne 0 ]];then if [[ $ecode -ne 0 ]];then
wsrep_log_error "Error while getting data from donor node: " \ wsrep_log_error "Error while getting data from donor node: " \
@ -762,7 +752,6 @@ send_donor()
exit 32 exit 32
fi fi
done done
} }
# Returns the version string in a standardized format # Returns the version string in a standardized format
@ -822,7 +811,6 @@ monitor_process()
done done
} }
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
wsrep_log_error "innobackupex not in path: $PATH" wsrep_log_error "innobackupex not in path: $PATH"
exit 2 exit 2
@ -843,7 +831,6 @@ if ! check_for_version $XB_VERSION $XB_REQUIRED_VERSION; then
exit 2 exit 2
fi fi
rm -f "${MAGIC_FILE}" 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
@ -862,7 +849,6 @@ if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
iopts+=" --no-backup-locks " iopts+=" --no-backup-locks "
fi fi
INNOEXTRA="" INNOEXTRA=""
if [[ $ssyslog -eq 1 ]];then if [[ $ssyslog -eq 1 ]];then
@ -870,7 +856,6 @@ if [[ $ssyslog -eq 1 ]];then
if [[ ! -x `which logger` ]];then if [[ ! -x `which logger` ]];then
wsrep_log_error "logger not in path: $PATH. Ignoring" wsrep_log_error "logger not in path: $PATH. Ignoring"
else else
wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog" 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) 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 # innobackupex implicitly writes PID to fixed location in $xtmpdir
XTRABACKUP_PID="$xtmpdir/xtrabackup_pid" XTRABACKUP_PID="$xtmpdir/xtrabackup_pid"
else # BYPASS FOR IST else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST" wsrep_log_info "Bypassing the SST for IST"
@ -1119,7 +1103,6 @@ then
MAGIC_FILE="${STATDIR}/${INFO_FILE}" 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 if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null
then 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."
@ -1138,7 +1121,6 @@ then
jpid=$! jpid=$!
wsrep_log_info "Proceeding with SST" wsrep_log_info "Proceeding with SST"
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" 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 \+ 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
fi fi
TDATA=${DATA} TDATA=${DATA}
DATA="${DATA}/.sst" DATA="${DATA}/.sst"
MAGIC_FILE="${DATA}/${INFO_FILE}" MAGIC_FILE="${DATA}/${INFO_FILE}"
wsrep_log_info "Waiting for SST streaming to complete!" wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid monitor_process $jpid
@ -1217,7 +1196,6 @@ then
dcmd="xargs -n 2 qpress -T${nproc}d" dcmd="xargs -n 2 qpress -T${nproc}d"
fi fi
# Decompress the qpress files # Decompress the qpress files
wsrep_log_info "Decompression with $nproc threads" wsrep_log_info "Decompression with $nproc threads"
timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd"
@ -1235,7 +1213,6 @@ then
fi fi
fi fi
if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
@ -1277,7 +1254,6 @@ then
exit 22 exit 22
fi fi
else else
wsrep_log_info "${IST_FILE} received from donor: Running IST" wsrep_log_info "${IST_FILE} received from donor: Running IST"
fi fi

View File

@ -18,9 +18,6 @@
# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html # 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! # Make sure to read that before proceeding!
. $(dirname $0)/wsrep_sst_common . $(dirname $0)/wsrep_sst_common
ealgo="" ealgo=""
@ -199,7 +196,6 @@ get_transfer()
fi fi
fi fi
fi fi
} }
get_footprint() get_footprint()
@ -278,7 +274,6 @@ get_stream()
else else
strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}" strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}"
fi fi
fi fi
} }
@ -333,9 +328,9 @@ cleanup_donor()
wsrep_log_error "xtrabackup process is still running. Killing... " wsrep_log_error "xtrabackup process is still running. Killing... "
kill_xtrabackup kill_xtrabackup
fi fi
rm -f $XTRABACKUP_PID rm -f $XTRABACKUP_PID
fi fi
rm -f ${DATA}/${IST_FILE} rm -f ${DATA}/${IST_FILE}
if [[ -n $progress && -p $progress ]];then if [[ -n $progress && -p $progress ]];then
@ -503,6 +498,7 @@ then
exit 1 exit 1
fi fi
done done
fi fi
echo "done ${WSREP_SST_OPT_GTID}" echo "done ${WSREP_SST_OPT_GTID}"
@ -600,6 +596,7 @@ then
if [ ! -r "${DATA}/${IST_FILE}" ] if [ ! -r "${DATA}/${IST_FILE}" ]
then then
wsrep_log_info "Proceeding with SST" wsrep_log_info "Proceeding with SST"
wsrep_log_info "Removing existing ib_logfile files" wsrep_log_info "Removing existing ib_logfile files"
if [[ $incremental -ne 1 ]];then if [[ $incremental -ne 1 ]];then
rm -f ${DATA}/ib_logfile* rm -f ${DATA}/ib_logfile*