Commit 124326d8 authored by Julius Goryavsky's avatar Julius Goryavsky

MDEV-28656: Inability to roll upgrade without stopping the Galera cluster

parent c168e167
......@@ -72,7 +72,7 @@ then
# (c) ERROR file, in case flush tables operation failed.
while [ ! -r "$FLUSHED" ] && \
! grep -q -F ':' -- "$FLUSHED" >/dev/null 2>&1
! grep -q -F ':' -- "$FLUSHED"
do
# Check whether ERROR file exists.
if [ -f "$ERROR" ]; then
......@@ -105,4 +105,5 @@ else # joiner
fi
wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE"
exit 0
......@@ -80,6 +80,7 @@ to_minuses()
}
WSREP_SST_OPT_BYPASS=0
WSREP_SST_OPT_PROGRESS=0
WSREP_SST_OPT_BINLOG=""
WSREP_SST_OPT_BINLOG_INDEX=""
WSREP_SST_OPT_LOG_BASENAME=""
......@@ -187,6 +188,10 @@ case "$1" in
'--bypass')
readonly WSREP_SST_OPT_BYPASS=1
;;
'--progress')
readonly WSREP_SST_OPT_PROGRESS=$(( $2 ))
shift
;;
'--datadir')
# Let's remove the trailing slash:
readonly WSREP_SST_OPT_DATA=$(trim_dir "$2")
......@@ -246,11 +251,11 @@ case "$1" in
shift
;;
'--local-port')
readonly WSREP_SST_OPT_LPORT="$2"
readonly WSREP_SST_OPT_LPORT=$(( $2 ))
shift
;;
'--parent')
readonly WSREP_SST_OPT_PARENT="$2"
readonly WSREP_SST_OPT_PARENT=$(( $2 ))
shift
;;
'--password')
......@@ -258,7 +263,7 @@ case "$1" in
shift
;;
'--port')
readonly WSREP_SST_OPT_PORT="$2"
readonly WSREP_SST_OPT_PORT=$(( $2 ))
shift
;;
'--role')
......@@ -531,6 +536,8 @@ else
readonly WSREP_SST_OPT_ROLE='donor'
fi
readonly WSREP_SST_OPT_PROGRESS
# The same argument can be present on the command line several
# times, in this case we must take its last value:
if [ -n "${MYSQLD_OPT_INNODB_DATA_HOME_DIR:-}" -a \
......
This diff is collapsed.
......@@ -65,21 +65,21 @@ cleanup_joiner()
if [ $failure -eq 0 ]; then
if cleanup_pid $RSYNC_REAL_PID "$RSYNC_PID" "$RSYNC_CONF"; then
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE"
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || :
[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE" || :
else
wsrep_log_warning "rsync cleanup failed."
fi
fi
wsrep_log_info "Joiner cleanup done."
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
wsrep_cleanup_progress_file
fi
[ -f "$SST_PID" ] && rm -f "$SST_PID" || :
wsrep_log_info "Joiner cleanup done."
exit $estatus
}
......@@ -318,7 +318,7 @@ if [ -n "$SSLMODE" -a "$SSLMODE" != 'DISABLED' ]; then
fi
readonly SECRET_TAG='secret'
readonly BYPASS_TAG='secret /bypass'
readonly BYPASS_TAG='bypass'
SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
......@@ -371,10 +371,11 @@ done
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE"
RC=0
if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
if [ -n "$STUNNEL" ]
then
if [ -n "$STUNNEL" ]; then
cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY
cert = $SSTCERT
......@@ -392,8 +393,6 @@ ${CHECK_OPT_LOCAL}
EOF
fi
RC=0
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed"
......@@ -410,19 +409,19 @@ EOF
# (c) ERROR file, in case flush tables operation failed.
while [ ! -r "$FLUSHED" ] && \
! grep -q -F ':' -- "$FLUSHED" 2>/dev/null
! grep -q -F ':' -- "$FLUSHED"
do
# Check whether ERROR file exists.
if [ -f "$ERROR" ]; then
# Flush tables operation failed.
rm -f "$ERROR"
rm "$ERROR"
exit 255
fi
sleep 0.2
done
STATE=$(cat "$FLUSHED")
rm -f "$FLUSHED"
rm "$FLUSHED"
sync
......@@ -629,6 +628,8 @@ FILTER="-f '- /lost+found'
wsrep_log_info "Transfer of data done"
[ -f "$BINLOG_TAR_FILE" ] && rm "$BINLOG_TAR_FILE"
else # BYPASS
wsrep_log_info "Bypassing state dump."
......@@ -657,6 +658,8 @@ FILTER="-f '- /lost+found'
--archive --quiet --checksum "$MAGIC_FILE" \
"rsync://$WSREP_SST_OPT_ADDR" >&2 || RC=$?
rm "$MAGIC_FILE"
if [ $RC -ne 0 ]; then
wsrep_log_error "rsync $MAGIC_FILE returned code $RC:"
exit 255 # unknown error
......@@ -665,8 +668,8 @@ FILTER="-f '- /lost+found'
echo "done $STATE"
if [ -n "$STUNNEL" ]; then
[ -f "$STUNNEL_CONF" ] && rm -f "$STUNNEL_CONF"
[ -f "$STUNNEL_PID" ] && rm -f "$STUNNEL_PID"
rm "$STUNNEL_CONF"
[ -f "$STUNNEL_PID" ] && rm "$STUNNEL_PID"
fi
else # joiner
......@@ -704,8 +707,7 @@ $SILENT
EOF
# If the IP is local, listen only on it:
if is_local_ip "$RSYNC_ADDR_UNESCAPED"
then
if is_local_ip "$RSYNC_ADDR_UNESCAPED"; then
RSYNC_EXTRA_ARGS="--address $RSYNC_ADDR_UNESCAPED"
STUNNEL_ACCEPT="$RSYNC_ADDR_UNESCAPED:$RSYNC_PORT"
else
......@@ -826,13 +828,8 @@ EOF
fi
if [ -n "$MY_SECRET" ]; then
# Select the "secret" tag whose value does not start
# with a slash symbol. All new tags must to start with
# the space and the slash symbol after the word "secret" -
# to be removed by older versions of the SST scripts:
SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]+[^/]" \
-- "$MAGIC_FILE" || :)
# Check donor supplied secret:
SECRET=$(grep -m1 -E "^$SECRET_TAG[[:space:]]" "$MAGIC_FILE" || :)
SECRET=$(trim_string "${SECRET#$SECRET_TAG}")
if [ "$SECRET" != "$MY_SECRET" ]; then
wsrep_log_error "Donor does not know my secret!"
......@@ -842,7 +839,7 @@ EOF
fi
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
if grep -m1 -qE "^$BYPASS_TAG([[:space:]]+.*)?\$" -- "$MAGIC_FILE"; then
if grep -m1 -qE "^$BYPASS_TAG([[:space:]]+.*)?\$" "$MAGIC_FILE"; then
readonly WSREP_SST_OPT_BYPASS=1
readonly WSREP_TRANSFER_TYPE='IST'
fi
......@@ -850,10 +847,10 @@ EOF
binlog_tar_present=0
if [ -f "$BINLOG_TAR_FILE" ]; then
binlog_tar_present=1
if [ $WSREP_SST_OPT_BYPASS -ne 0 ]; then
wsrep_log_warning "tar with binlogs transferred in the IST mode"
fi
binlog_tar_present=1
fi
if [ $WSREP_SST_OPT_BYPASS -eq 0 -a -n "$WSREP_SST_OPT_BINLOG" ]; then
......@@ -867,7 +864,7 @@ EOF
while read bin_file || [ -n "$bin_file" ]; do
rm -f "$bin_file" || :
done < "$binlog_index"
rm -f "$binlog_index"
rm "$binlog_index"
fi
binlog_cd=0
# Change the directory to binlog base (if possible):
......@@ -902,7 +899,6 @@ EOF
fi
# Extracting binlog files:
wsrep_log_info "Extracting binlog files:"
RC=0
if tar --version | grep -qw -E '^bsdtar'; then
tar -tf "$BINLOG_TAR_FILE" > "$tmpfile" && \
tar -xvf "$BINLOG_TAR_FILE" > /dev/null || RC=$?
......@@ -912,7 +908,7 @@ EOF
fi
if [ $RC -ne 0 ]; then
wsrep_log_error "Error unpacking tar file with binlog files"
rm -f "$tmpfile"
rm "$tmpfile"
exit 32
fi
# Rebuild binlog index:
......@@ -920,18 +916,16 @@ EOF
while read bin_file || [ -n "$bin_file" ]; do
echo "$binlog_dir${binlog_dir:+/}$bin_file" >> "$binlog_index"
done < "$tmpfile"
rm -f "$tmpfile"
rm "$tmpfile"
cd "$OLD_PWD"
fi
fi
# Remove special tags from the magic file, and from the output:
coords=$(grep -v -E "^$SECRET_TAG[[:space:]]" -- "$MAGIC_FILE")
coords=$(head -n1 "$MAGIC_FILE")
wsrep_log_info "Galera co-ords from recovery: $coords"
echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id
fi
[ -f "$BINLOG_TAR_FILE" ] && rm -f "$BINLOG_TAR_FILE"
wsrep_log_info "$WSREP_METHOD $WSREP_TRANSFER_TYPE completed on $WSREP_SST_OPT_ROLE"
exit 0
......@@ -998,12 +998,14 @@ static ssize_t sst_prepare_other (const char* method,
WSREP_SST_OPT_ADDR " '%s' "
WSREP_SST_OPT_DATA " '%s' "
"%s"
WSREP_SST_OPT_PARENT " '%d'"
WSREP_SST_OPT_PARENT " %d "
WSREP_SST_OPT_PROGRESS " %d"
"%s"
"%s",
method, addr_in, mysql_real_data_home,
wsrep_defaults_file,
(int)getpid(),
0,
binlog_opt_val, binlog_index_opt_val);
my_free(binlog_opt_val);
......@@ -1724,16 +1726,18 @@ static int sst_donate_other (const char* method,
"wsrep_sst_%s "
WSREP_SST_OPT_ROLE " 'donor' "
WSREP_SST_OPT_ADDR " '%s' "
WSREP_SST_OPT_LPORT " '%u' "
WSREP_SST_OPT_LPORT " %u "
WSREP_SST_OPT_SOCKET " '%s' "
WSREP_SST_OPT_PROGRESS " %d "
WSREP_SST_OPT_DATA " '%s' "
"%s"
WSREP_SST_OPT_GTID " '%s:%lld' "
WSREP_SST_OPT_GTID_DOMAIN_ID " '%d'"
WSREP_SST_OPT_GTID_DOMAIN_ID " %d"
"%s"
"%s"
"%s",
method, addr, mysqld_port, mysqld_unix_port,
0,
mysql_real_data_home,
wsrep_defaults_file,
uuid, (long long) seqno, wsrep_gtid_domain_id,
......
......@@ -32,6 +32,7 @@
#define WSREP_SST_OPT_PARENT "--parent"
#define WSREP_SST_OPT_BINLOG "--binlog"
#define WSREP_SST_OPT_BINLOG_INDEX "--binlog-index"
#define WSREP_SST_OPT_PROGRESS "--progress"
#define WSREP_SST_OPT_MYSQLD "--mysqld-args"
// mysqldump-specific options
......
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