Commit e0324bf3 authored by Julius Goryavsky's avatar Julius Goryavsky

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.
parent 562c8825
......@@ -194,9 +194,9 @@ case "$1" in
shift
;;
'--binlog-index')
WSREP_SST_OPT_BINLOG_INDEX="$2"
shift
;;
WSREP_SST_OPT_BINLOG_INDEX="$2"
shift
;;
'--gtid-domain-id')
readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2"
shift
......@@ -298,11 +298,11 @@ fi
wsrep_defaults="$WSREP_SST_OPT_DEFAULT"
if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults "
wsrep_defaults="$wsrep_defaults "
fi
wsrep_defaults="$wsrep_defaults$WSREP_SST_OPT_EXTRA_DEFAULT"
if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults "
wsrep_defaults="$wsrep_defaults "
fi
readonly WSREP_SST_OPT_CONF="$wsrep_defaults$WSREP_SST_OPT_SUFFIX_DEFAULT"
readonly MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF"
......
This diff is collapsed.
......@@ -100,12 +100,12 @@ SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';"
SET_WSREP_GTID_DOMAIN_ID=""
if [ -n $WSREP_SST_OPT_GTID_DOMAIN_ID ]
then
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 @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;
EXECUTE stmt;
DROP PREPARE stmt;"
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 @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;
EXECUTE stmt;
DROP PREPARE stmt;"
fi
MYSQL="$MYSQL_CLIENT $WSREP_SST_OPT_CONF "\
......@@ -132,16 +132,16 @@ SQL_LOG_BIN_OFF=""
# Safety check
if [ "${SERVER_VERSION%%.*}" != '5' ]
then
# 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
# 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
# the dump gets replayed on joiner.
if [[ "$LOG_BIN" == 'ON' ]]; then
RESET_MASTER="RESET MASTER;"
SET_GTID_BINLOG_STATE="SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE';"
SQL_LOG_BIN_OFF="SET @@session.sql_log_bin=OFF;"
fi
# 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
# 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
# the dump gets replayed on joiner.
if [[ "$LOG_BIN" == 'ON' ]]; then
RESET_MASTER="RESET MASTER;"
SET_GTID_BINLOG_STATE="SET @@global.gtid_binlog_state='$GTID_BINLOG_STATE';"
SQL_LOG_BIN_OFF="SET @@session.sql_log_bin=OFF;"
fi
fi
# NOTE: we don't use --routines here because we're dumping mysql.proc table
......
......@@ -74,8 +74,8 @@ check_pid_and_port()
;;
*)
if ! which lsof > /dev/null; then
wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
exit 2 # ENOENT
wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed."
exit 2 # ENOENT
fi
local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \
......@@ -107,15 +107,15 @@ is_local_ip()
local get_addr_bin=`which ifconfig`
if [ -z "$get_addr_bin" ]
then
get_addr_bin=`which ip`
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
# ip output format is "X.X.X.X/mask"
address="${address}/"
get_addr_bin=`which ip`
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
# ip output format is "X.X.X.X/mask"
address="${address}/"
else
# 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 "
address="$address "
# 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 "
address="$address "
fi
$get_addr_bin | grep -F "$address" > /dev/null
......@@ -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
......@@ -461,22 +463,22 @@ EOF
# If the IP is local listen only in it
if is_local_ip "$RSYNC_ADDR"
then
RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR"
STUNNEL_ACCEPT="$RSYNC_ADDR:$RSYNC_PORT"
RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR"
STUNNEL_ACCEPT="$RSYNC_ADDR:$RSYNC_PORT"
else
# Not local, possibly a NAT, listen on all interfaces
RSYNC_EXTRA_ARGS=""
STUNNEL_ACCEPT="$RSYNC_PORT"
# Overwrite address with all
RSYNC_ADDR="*"
# Not local, possibly a NAT, listen on all interfaces
RSYNC_EXTRA_ARGS=""
STUNNEL_ACCEPT="$RSYNC_PORT"
# Overwrite address with all
RSYNC_ADDR="*"
fi
if [ -z "$STUNNEL" ]
then
rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" ${RSYNC_EXTRA_ARGS} &
RSYNC_REAL_PID=$!
rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" ${RSYNC_EXTRA_ARGS} &
RSYNC_REAL_PID=$!
else
cat << EOF > "$STUNNEL_CONF"
cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY
cert = $SSTCERT
foreground = yes
......@@ -488,9 +490,9 @@ accept = $STUNNEL_ACCEPT
exec = $(which rsync)
execargs = rsync --server --daemon --config=$RSYNC_CONF .
EOF
stunnel "$STUNNEL_CONF" &
RSYNC_REAL_PID=$!
RSYNC_PID=$STUNNEL_PID
stunnel "$STUNNEL_CONF" &
RSYNC_REAL_PID=$!
RSYNC_PID=$STUNNEL_PID
fi
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 ]
then
OLD_PWD="$(pwd)"
cd $BINLOG_DIRNAME
......@@ -532,14 +533,15 @@ EOF
do
if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
then
then
echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
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
......
This diff is collapsed.
This diff is collapsed.
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