Commit b0ef1b38 authored by Marko Mäkelä's avatar Marko Mäkelä

After-merge fix: Revert MDEV-15511

My conflict resolution for the script did not work out after all,
and apparently I was testing a wrong version. Revert MDEV-15511
from MariaDB 10.2 for now.
parent 9258097f
...@@ -41,8 +41,6 @@ cleanup_joiner() ...@@ -41,8 +41,6 @@ cleanup_joiner()
kill -9 $RSYNC_REAL_PID >/dev/null 2>&1 || \ kill -9 $RSYNC_REAL_PID >/dev/null 2>&1 || \
: :
rm -rf "$RSYNC_CONF" rm -rf "$RSYNC_CONF"
rm -f "$STUNNEL_CONF"
rm -f "$STUNNEL_PID"
rm -rf "$MAGIC_FILE" rm -rf "$MAGIC_FILE"
rm -rf "$RSYNC_PID" rm -rf "$RSYNC_PID"
wsrep_log_info "Joiner cleanup done." wsrep_log_info "Joiner cleanup done."
...@@ -70,7 +68,7 @@ check_pid_and_port() ...@@ -70,7 +68,7 @@ check_pid_and_port()
local port_info="$(sockstat -46lp ${rsync_port} 2>/dev/null | \ local port_info="$(sockstat -46lp ${rsync_port} 2>/dev/null | \
grep ":${rsync_port}")" grep ":${rsync_port}")"
local is_rsync="$(echo $port_info | \ local is_rsync="$(echo $port_info | \
grep -wE '[[:space:]]\+(rsync|stunnel)[[:space:]]\+'"$rsync_pid" 2>/dev/null)" grep '[[:space:]]\+rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)"
;; ;;
*) *)
if ! which lsof > /dev/null; then if ! which lsof > /dev/null; then
...@@ -81,7 +79,7 @@ check_pid_and_port() ...@@ -81,7 +79,7 @@ check_pid_and_port()
local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \ local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \
grep "(LISTEN)")" grep "(LISTEN)")"
local is_rsync="$(echo $port_info | \ local is_rsync="$(echo $port_info | \
grep -wE '^(rsync|stunnel)[[:space:]]\+'"$rsync_pid" 2>/dev/null)" grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)"
;; ;;
esac esac
...@@ -121,12 +119,6 @@ is_local_ip() ...@@ -121,12 +119,6 @@ is_local_ip()
$get_addr_bin | grep "$address" > /dev/null $get_addr_bin | grep "$address" > /dev/null
} }
STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf"
rm -f "$STUNNEL_CONF"
STUNNEL_PID="$WSREP_SST_OPT_DATA/stunnel.pid"
rm -f "$STUNNEL_PID"
MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
rm -rf "$MAGIC_FILE" rm -rf "$MAGIC_FILE"
...@@ -164,28 +156,9 @@ fi ...@@ -164,28 +156,9 @@ fi
FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
-f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'" -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'"
SSTKEY=$(parse_cnf sst tkey "")
SSTCERT=$(parse_cnf sst tcert "")
STUNNEL=""
if [ -f "$SSTKEY" ] && [ -f "$SSTCERT" ] && wsrep_check_programs stunnel
then
STUNNEL="stunnel ${STUNNEL_CONF}"
fi
if [ "$WSREP_SST_OPT_ROLE" = "donor" ] if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
then then
cat << EOF > "$STUNNEL_CONF"
CApath = ${SSTCERT%/*}
foreground = yes
pid = $STUNNEL_PID
debug = warning
client = yes
connect = ${WSREP_SST_OPT_ADDR%/*}
TIMEOUTclose = 0
verifyPeer = yes
EOF
if [ $WSREP_SST_OPT_BYPASS -eq 0 ] if [ $WSREP_SST_OPT_BYPASS -eq 0 ]
then then
...@@ -247,8 +220,7 @@ EOF ...@@ -247,8 +220,7 @@ EOF
# first, the normal directories, so that we can detect incompatible protocol # first, the normal directories, so that we can detect incompatible protocol
RC=0 RC=0
eval rsync ${STUNNEL:+--rsh="$STUNNEL"} \ eval rsync --owner --group --perms --links --specials \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \ --ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT ${FILTER} "$WSREP_SST_OPT_DATA/" \ $WHOLE_FILE_OPT ${FILTER} "$WSREP_SST_OPT_DATA/" \
rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$?
...@@ -271,8 +243,7 @@ EOF ...@@ -271,8 +243,7 @@ EOF
fi fi
# second, we transfer InnoDB log files # second, we transfer InnoDB log files
rsync ${STUNNEL:+--rsh="$STUNNEL"} \ rsync --owner --group --perms --links --specials \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \ --ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \ $WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '- **' "$WSREP_LOG_DIR/" \
rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$? rsync://$WSREP_SST_OPT_ADDR-log_dir >&2 || RC=$?
...@@ -292,8 +263,7 @@ EOF ...@@ -292,8 +263,7 @@ EOF
find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" \ find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" \
-print0 | xargs -I{} -0 -P $count \ -print0 | xargs -I{} -0 -P $count \
rsync ${STUNNEL:+--rsh="$STUNNEL"} \ rsync --owner --group --perms --links --specials \
--owner --group --perms --links --specials \
--ignore-times --inplace --recursive --delete --quiet \ --ignore-times --inplace --recursive --delete --quiet \
$WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \
rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$?
...@@ -316,8 +286,7 @@ EOF ...@@ -316,8 +286,7 @@ EOF
echo "continue" # now server can resume updating data echo "continue" # now server can resume updating data
echo "$STATE" > "$MAGIC_FILE" echo "$STATE" > "$MAGIC_FILE"
rsync ${STUNNEL:+--rsh="$STUNNEL"} \ rsync --archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR
--archive --quiet --checksum "$MAGIC_FILE" rsync://$WSREP_SST_OPT_ADDR
echo "done $STATE" echo "done $STATE"
...@@ -372,41 +341,20 @@ $SILENT ...@@ -372,41 +341,20 @@ $SILENT
path = $WSREP_LOG_DIR path = $WSREP_LOG_DIR
EOF EOF
cat << EOF > "$STUNNEL_CONF"
key = $SSTKEY
cert = $SSTCERT
foreground = yes
pid = $STUNNEL_PID
debug = warning
client = no
[rsync]
accept = $RSYNC_PORT
exec = $(which rsync)
execargs = rsync --server --daemon --config=$RSYNC_CONF .
EOF
# rm -rf "$DATA"/ib_logfile* # we don't want old logs around # rm -rf "$DATA"/ib_logfile* # we don't want old logs around
readonly RSYNC_PORT=${WSREP_SST_OPT_PORT:-4444} readonly RSYNC_PORT=${WSREP_SST_OPT_PORT:-4444}
# If the IP is local listen only in it
if [ -z "$STUNNEL" ] if is_local_ip "$RSYNC_ADDR"
then then
# If the IP is local listen only in it rsync --daemon --no-detach --address "$RSYNC_ADDR" --port "$RSYNC_PORT" --config "$RSYNC_CONF" &
if is_local_ip "$RSYNC_ADDR"
then
rsync --daemon --no-detach --address "$RSYNC_ADDR" --port "$RSYNC_PORT" --config "$RSYNC_CONF" &
else
# Not local, possibly a NAT, listen in all interfaces
rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" &
# Overwrite address with all
RSYNC_ADDR=""
fi
RSYNC_REAL_PID=$!
else else
stunnel "$STUNNEL_CONF" & # Not local, possibly a NAT, listen in all interface
RSYNC_REAL_PID=$! rsync --daemon --no-detach --port "$RSYNC_PORT" --config "$RSYNC_CONF" &
RSYNC_PID=$STUNNEL_PID # Overwrite address with all
RSYNC_ADDR="*"
fi fi
RSYNC_REAL_PID=$!
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"
do do
......
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