Commit 53c4be7b authored by Julius Goryavsky's avatar Julius Goryavsky

MDEV-30220: rsync SST completely ignores aria-log-dir-path

This commit adds support for the --aria-log-dir-path
option on the command line and for the aria-log-dir-path
option in the configuration file to the SST scripts, since
before this change these parameters were completely ignored
during SST - SST scripts assumed that aria logs files are
always located in the same directory as logs for innodb.

Tests for this change will be added as a separate commit,
along with tests for MDEV-30157 and MDEV-28669.
parent b84f3fa7
......@@ -134,6 +134,7 @@ WSREP_SST_OPT_ADDR=""
WSREP_SST_OPT_ADDR_PORT=""
WSREP_SST_OPT_HOST=""
WSREP_SST_OPT_HOST_UNESCAPED=""
ARIA_LOG_DIR=""
INNODB_DATA_HOME_DIR=$(trim_dir "${INNODB_DATA_HOME_DIR:-}")
INNODB_LOG_GROUP_HOME=$(trim_dir "${INNODB_LOG_GROUP_HOME:-}")
INNODB_UNDO_DIR=$(trim_dir "${INNODB_UNDO_DIR:-}")
......@@ -234,6 +235,11 @@ case "$1" in
readonly WSREP_SST_OPT_DATA=$(trim_dir "$2")
shift
;;
'--aria-log-dir-path')
# Let's remove the trailing slash:
readonly ARIA_LOG_DIR=$(trim_dir "$2")
shift
;;
'--innodb-data-home-dir')
# Let's remove the trailing slash:
readonly INNODB_DATA_HOME_DIR=$(trim_dir "$2")
......@@ -499,6 +505,12 @@ case "$1" in
# from mysqld's argument list:
skip_mysqld_arg=0
case "$option" in
'--aria-log-dir-path')
if [ -z "$ARIA_LOG_DIR" ]; then
MYSQLD_OPT_ARIA_LOG_DIR=$(trim_dir "$value")
fi
skip_mysqld_arg=1
;;
'--innodb-data-home-dir')
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
MYSQLD_OPT_INNODB_DATA_HOME_DIR=$(trim_dir "$value")
......@@ -592,6 +604,10 @@ 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_ARIA_LOG_DIR:-}" -a \
-z "$ARIA_LOG_DIR" ]; then
readonly ARIA_LOG_DIR="$MYSQLD_OPT_ARIA_LOG_DIR"
fi
if [ -n "${MYSQLD_OPT_INNODB_DATA_HOME_DIR:-}" -a \
-z "$INNODB_DATA_HOME_DIR" ]; then
readonly INNODB_DATA_HOME_DIR="$MYSQLD_OPT_INNODB_DATA_HOME_DIR"
......@@ -649,6 +665,9 @@ if [ -n "$WSREP_SST_OPT_LOG_BASENAME" ]; then
WSREP_SST_OPT_MYSQLD="--log-basename='$WSREP_SST_OPT_LOG_BASENAME'"
fi
fi
if [ -n "$ARIA_LOG_DIR" ]; then
INNOEXTRA="$INNOEXTRA --aria-log-dir-path='$ARIA_LOG_DIR'"
fi
if [ -n "$INNODB_DATA_HOME_DIR" ]; then
INNOEXTRA="$INNOEXTRA --innodb-data-home-dir='$INNODB_DATA_HOME_DIR'"
fi
......
......@@ -55,6 +55,7 @@ speciald=1
ib_home_dir=""
ib_log_dir=""
ib_undo_dir=""
ar_log_dir=""
sfmt=""
strmcmd=""
......@@ -1271,6 +1272,24 @@ else # joiner
[ "$ib_undo_dir" = "$DATA_DIR" ] && ib_undo_dir=""
fi
# if no command line argument then try to get it from the my.cnf:
if [ -z "$ARIA_LOG_DIR" ]; then
ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path')
ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR")
fi
if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \
"$ARIA_LOG_DIR" != "$DATA_DIR" ]
then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR"
cd "$ARIA_LOG_DIR"
ar_log_dir="$(pwd)"
cd "$OLD_PWD"
[ "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir=""
fi
if [ -n "$backup_threads" ]; then
impts="--parallel=$backup_threads${impts:+ }$impts"
fi
......@@ -1410,12 +1429,14 @@ else # joiner
find -E ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
${ar_log_dir:+"$ar_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rf {} >&2 \+
else
find ${ib_home_dir:+"$ib_home_dir"} \
${ib_undo_dir:+"$ib_undo_dir"} \
${ib_log_dir:+"$ib_log_dir"} \
${ar_log_dir:+"$ar_log_dir"} \
"$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rf {} >&2 \+
fi
......
......@@ -174,6 +174,7 @@ cd "$OLD_PWD"
BINLOG_TAR_FILE="$DATA_DIR/wsrep_sst_binlog.tar"
ar_log_dir="$DATA_DIR"
ib_log_dir="$DATA_DIR"
ib_home_dir="$DATA_DIR"
ib_undo_dir="$DATA_DIR"
......@@ -232,6 +233,23 @@ then
cd "$OLD_PWD"
fi
# if no command line argument then try to get it from the my.cnf:
if [ -z "$ARIA_LOG_DIR" ]; then
ARIA_LOG_DIR=$(parse_cnf '--mysqld' 'aria-log-dir-path')
ARIA_LOG_DIR=$(trim_dir "$ARIA_LOG_DIR")
fi
if [ -n "$ARIA_LOG_DIR" -a "$ARIA_LOG_DIR" != '.' -a \
"$ARIA_LOG_DIR" != "$DATA_DIR" ]
then
# handle both relative and absolute paths:
cd "$DATA"
[ ! -d "$ARIA_LOG_DIR" ] && mkdir -p "$ARIA_LOG_DIR"
cd "$ARIA_LOG_DIR"
ar_log_dir="$(pwd)"
cd "$OLD_PWD"
fi
encgroups='--mysqld|sst'
check_server_ssl_config
......@@ -551,8 +569,8 @@ FILTER="-f '- /lost+found'
-f '- $ib_home_dir/ibdata*'
-f '- $ib_undo_dir/undo*'
-f '- $ib_log_dir/ib_logfile[0-9]*'
-f '- $ib_log_dir/aria_log_control'
-f '- $ib_log_dir/aria_log.*'
-f '- $ar_log_dir/aria_log_control'
-f '- $ar_log_dir/aria_log.*'
-f '+ /*/'
-f '- /*'"
......@@ -598,12 +616,12 @@ FILTER="-f '- /lost+found'
wsrep_log_info "Transfer of InnoDB data files done"
# second, we transfer InnoDB and Aria log files
# second, we transfer InnoDB log files
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' -f '+ /aria_log.*' \
-f '+ /aria_log_control' -f '- **' "$ib_log_dir/" \
$WHOLE_FILE_OPT -f '+ /ib_logfile[0-9]*' \
-f '- **' "$ib_log_dir/" \
"rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$?
if [ $RC -ne 0 ]; then
......@@ -611,7 +629,7 @@ FILTER="-f '- /lost+found'
exit 255 # unknown error
fi
wsrep_log_info "Transfer of InnoDB and Aria log files done"
wsrep_log_info "Transfer of InnoDB log files done"
# third, we transfer InnoDB undo logs
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
......@@ -628,6 +646,21 @@ FILTER="-f '- /lost+found'
wsrep_log_info "Transfer of InnoDB undo logs done"
# fourth, we transfer Aria logs
rsync ${STUNNEL:+--rsh="$STUNNEL"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
$WHOLE_FILE_OPT -f '+ /aria_log_control' -f '+ /aria_log.*' \
-f '- **' "$ar_log_dir/" \
"rsync://$WSREP_SST_OPT_ADDR-aria_log" >&2 || RC=$?
if [ $RC -ne 0 ]; then
wsrep_log_error "rsync aria_log_dir_path returned code $RC:"
exit 255 # unknown error
fi
wsrep_log_info "Transfer of Aria logs done"
# then, we parallelize the transfer of database directories,
# use '.' so that path concatenation works:
......@@ -648,8 +681,8 @@ FILTER="-f '- /lost+found'
-f '- $ib_home_dir/ibdata*' \
-f '- $ib_undo_dir/undo*' \
-f '- $ib_log_dir/ib_logfile[0-9]*' \
-f '- $ib_log_dir/aria_log_control' \
-f '- $ib_log_dir/aria_log.*' \
-f '- $ar_log_dir/aria_log_control' \
-f '- $ar_log_dir/aria_log.*' \
"$WSREP_SST_OPT_DATA/{}/" \
"rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$?
......@@ -740,6 +773,8 @@ $SILENT
path = $ib_home_dir
[$MODULE-undo_dir]
path = $ib_undo_dir
[$MODULE-aria_log]
path = $ar_log_dir
EOF
# If the IP is local, listen only on it:
......
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