summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJulius Goryavsky <julius.goryavsky@mariadb.com>2022-12-13 15:44:24 +0100
committerJulius Goryavsky <julius.goryavsky@mariadb.com>2023-01-11 15:01:00 +0100
commit53c4be7bc02949e178b31fd89c4b196dd7f24bd0 (patch)
tree4e71411ac10140249a7b194bbd8eb59b6eb263de /scripts
parentb84f3fa769228c4ffd367bc8f2426e6e912325a5 (diff)
downloadmariadb-git-53c4be7bc02949e178b31fd89c4b196dd7f24bd0.tar.gz
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/wsrep_sst_common.sh19
-rw-r--r--scripts/wsrep_sst_mariabackup.sh21
-rw-r--r--scripts/wsrep_sst_rsync.sh51
3 files changed, 83 insertions, 8 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 407a4c9dd24..4e177073872 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -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
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 7465b2a3b08..7e26af83701 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -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
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 123b0ab04dc..5279929c5b0 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -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: