diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-01-13 11:11:04 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-01-13 11:11:04 +0200 |
commit | 88c35781cc9f5f3c63de98a8b6e7eb3378d4fae5 (patch) | |
tree | 1a2c280180c19e71b87e520546b3d2473af3b1bd /scripts | |
parent | 92c8d6f168f329bf7e3998a4f580781d0239b59a (diff) | |
parent | 1e04cafcba88e1801e828a5bbab7fe9fdd7ca61c (diff) | |
download | mariadb-git-88c35781cc9f5f3c63de98a8b6e7eb3378d4fae5.tar.gz |
Merge 10.7 into 10.8
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/mariadb-service-convert | 2 | ||||
-rw-r--r-- | scripts/mysqlaccess.sh | 2 | ||||
-rw-r--r-- | scripts/wsrep_sst_common.sh | 132 | ||||
-rw-r--r-- | scripts/wsrep_sst_mariabackup.sh | 51 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 104 |
5 files changed, 229 insertions, 62 deletions
diff --git a/scripts/mariadb-service-convert b/scripts/mariadb-service-convert index e43b9b926d5..ee7af1b323f 100755 --- a/scripts/mariadb-service-convert +++ b/scripts/mariadb-service-convert @@ -36,7 +36,7 @@ echo '[Service]' echo -if [[ ( "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then +if [[ ( ! -z "$user" && "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then echo User=$user fi diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index f6dbee75b87..c9b1b72dc21 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -584,7 +584,7 @@ if ($MySQLaccess::CGI) { #CGI-version # ---------------------- # brief and table-format # exclude each-other -# table-format is prefered +# table-format is preferred if (defined($Param{'table'})) { undef($Param{'brief'}); } if (defined($Param{'preview'}) or defined($Param{'copy'}) or diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index d98a336d3a8..bf96f79e15e 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -47,18 +47,51 @@ trim_string() trim_dir() { - local t=$(trim_string "$1") - if [ "$t" != '/' ]; then - if [ "${t%/}" != "$t" ]; then - t=$(trim_string "${t%/}") + if [ -n "$BASH_VERSION" ]; then + local pattern="![:space:]${2:-}" + local x="${1#*[$pattern]}" + local z=${#1} + x=${#x} + if [ $x -ne $z ]; then + local y="${1%[$pattern/]*}" + y=${#y} + x=$(( z-x-1 )) + y=$(( y-x+1 )) + x="${1:$x:$y}" + [ -z "$x" ] && x='.' + printf '%s' "$x" + else + printf '' fi else - t='.' + local pattern="[:space:]${2:-}" + local x=$(echo "$1" | sed -E "s/^[$pattern]+|[$pattern/]+\$//g") + if [ -n "$x" ]; then + echo "$x" + elif "${1#*/}" != "$1"; then + echo '.' + else + echo '' + fi fi +} + +trim_right() +{ if [ -n "$BASH_VERSION" ]; then - printf '%s' "$t" + local pattern="[![:space:]${2:-}]" + local z=${#1} + local y="${1%$pattern*}" + y=${#y} + if [ $y -ne $z ]; then + y=$(( y+1 )) + printf '%s' "${1:0:$y}" + else + printf '' + fi else - echo "$t" + local pattern="[[:space:]${2:-}]" + echo "$1" | sed -E "s/$pattern+\$//g" fi } @@ -101,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:-}") @@ -111,7 +145,7 @@ INNOEXTRA="" while [ $# -gt 0 ]; do case "$1" in '--address') - WSREP_SST_OPT_ADDR="$2" + WSREP_SST_OPT_ADDR=$(trim_string "$2") # # Break address string into host:port/path parts # @@ -119,20 +153,22 @@ case "$1" in \[*) # IPv6 # Remove the starting and ending square brackets, if present: - addr_no_bracket="${WSREP_SST_OPT_ADDR#\[}" + addr="${WSREP_SST_OPT_ADDR#\[}" + addr=$(trim_right "${addr%%\]*}") # Some utilities and subsequent code require an address # without square brackets: - readonly WSREP_SST_OPT_HOST_UNESCAPED="${addr_no_bracket%%\]*}" + readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr" # Square brackets are needed in most cases: - readonly WSREP_SST_OPT_HOST="[$WSREP_SST_OPT_HOST_UNESCAPED]" + readonly WSREP_SST_OPT_HOST="[$addr]" # Mark this address as IPv6: readonly WSREP_SST_OPT_HOST_IPv6=1 # Let's remove the leading part that contains the host address: remain="${WSREP_SST_OPT_ADDR#*\]}" ;; *) - readonly WSREP_SST_OPT_HOST="${WSREP_SST_OPT_ADDR%%[:/]*}" - readonly WSREP_SST_OPT_HOST_UNESCAPED="$WSREP_SST_OPT_HOST" + addr=$(trim_right "${WSREP_SST_OPT_ADDR%%[:/]*}") + readonly WSREP_SST_OPT_HOST="$addr" + readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr" readonly WSREP_SST_OPT_HOST_IPv6=0 # Let's remove the leading part that contains the host address: remain="${WSREP_SST_OPT_ADDR#*[:/]}" @@ -154,17 +190,18 @@ case "$1" in else readonly WSREP_SST_OPT_PATH="" fi + WSREP_SST_OPT_ADDR_PORT=$(trim_right "$WSREP_SST_OPT_ADDR_PORT") # Remove the module name part from the string, which ends with "/": remain="${WSREP_SST_OPT_PATH#*/}" # This operation removes the tail after the very first occurrence # of the "/" character, inclusively: - readonly WSREP_SST_OPT_MODULE="${WSREP_SST_OPT_PATH%%/*}" + readonly WSREP_SST_OPT_MODULE=$(trim_right "${WSREP_SST_OPT_PATH%%/*}") # If there is one more "/" in the string, then everything before # it will be the LSN, otherwise the LSN is empty: if [ "$remain" != "$WSREP_SST_OPT_PATH" ]; then # Extract the part that matches the LSN by removing all # characters starting from the very first "/": - readonly WSREP_SST_OPT_LSN="${remain%%/*}" + readonly WSREP_SST_OPT_LSN=$(trim_right "${remain%%/*}") # Exctract everything after the first occurrence of # the "/" character in the string: source="$remain" @@ -176,7 +213,7 @@ case "$1" in # Let's extract the version number by removing the tail # after the very first occurence of the "/" character # (inclusively): - readonly WSREP_SST_OPT_SST_VER="${remain%%/*}" + readonly WSREP_SST_OPT_SST_VER=$(trim_right "${remain%%/*}") else readonly WSREP_SST_OPT_SST_VER="" fi @@ -198,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") @@ -218,41 +260,46 @@ case "$1" in shift ;; '--defaults-file') - readonly WSREP_SST_OPT_DEFAULT="$1=$2" - readonly WSREP_SST_OPT_DEFAULTS="$1='$2'" + file=$(trim_string "$2") + readonly WSREP_SST_OPT_DEFAULT="$1=$file" + readonly WSREP_SST_OPT_DEFAULTS="$1='$file'" shift ;; '--defaults-extra-file') - readonly WSREP_SST_OPT_EXTRA_DEFAULT="$1=$2" - readonly WSREP_SST_OPT_EXTRA_DEFAULTS="$1='$2'" + file=$(trim_string "$2") + readonly WSREP_SST_OPT_EXTRA_DEFAULT="$1=$file" + readonly WSREP_SST_OPT_EXTRA_DEFAULTS="$1='$file'" shift ;; '--defaults-group-suffix') - readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$2" - readonly WSREP_SST_OPT_SUFFIX_VALUE="$2" + suffix=$(trim_string "$2") + readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$suffix" + readonly WSREP_SST_OPT_SUFFIX_VALUE="$suffix" shift ;; '--host') - case "$2" in + addr=$(trim_string "$2") + case "$addr" in \[*) # IPv6 # Remove the starting and ending square brackets, if present: - addr_no_bracket="${2#\[}" + addr="${addr#\[}" + addr=$(trim_right "${addr%%\]*}") # Some utilities and subsequent code require an address # without square brackets: - readonly WSREP_SST_OPT_HOST_UNESCAPED="${addr_no_bracket%%\]*}" + readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr" # Square brackets are needed in most cases: - readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]" + readonly WSREP_SST_OPT_HOST="[$addr]" # Mark this address as IPv6: readonly WSREP_SST_OPT_HOST_IPv6=1 ;; *) - readonly WSREP_SST_OPT_HOST="$2" - readonly WSREP_SST_OPT_HOST_UNESCAPED="$2" + readonly WSREP_SST_OPT_HOST="$addr" + readonly WSREP_SST_OPT_HOST_UNESCAPED="$addr" readonly WSREP_SST_OPT_HOST_IPv6=0 ;; esac - WSREP_SST_OPT_ADDR="$WSREP_SST_OPT_HOST" + WSREP_SST_OPT_ADDR="$addr" shift ;; '--local-port') @@ -272,11 +319,11 @@ case "$1" in shift ;; '--role') - readonly WSREP_SST_OPT_ROLE="$2" + readonly WSREP_SST_OPT_ROLE=$(trim_string "$2") shift ;; '--socket') - readonly WSREP_SST_OPT_SOCKET="$2" + readonly WSREP_SST_OPT_SOCKET=$(trim_string "$2") shift ;; '--user') @@ -284,23 +331,23 @@ case "$1" in shift ;; '--gtid') - readonly WSREP_SST_OPT_GTID="$2" + readonly WSREP_SST_OPT_GTID=$(trim_string "$2") shift ;; '--binlog'|'--log-bin') - readonly WSREP_SST_OPT_BINLOG="$2" + readonly WSREP_SST_OPT_BINLOG=$(trim_string "$2") shift ;; '--binlog-index'|'--log-bin-index') - WSREP_SST_OPT_BINLOG_INDEX="$2" + WSREP_SST_OPT_BINLOG_INDEX=$(trim_string "$2") shift ;; '--log-basename') - readonly WSREP_SST_OPT_LOG_BASENAME="$2" + readonly WSREP_SST_OPT_LOG_BASENAME=$(trim_string "$2") shift ;; '--gtid-domain-id') - readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2" + readonly WSREP_SST_OPT_GTID_DOMAIN_ID=$(trim_string "$2") shift ;; '--mysqld-args') @@ -458,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") @@ -551,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" @@ -608,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 63ef8be8690..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="" @@ -439,9 +440,10 @@ get_footprint() -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ awk 'END { print $1 }') - local payload_undo=0 - if [ -n "$ib_undo_dir" -a -d "$ib_undo_dir" ]; then + if [ -n "$ib_undo_dir" -a "$ib_undo_dir" != '.' -a \ + "$ib_undo_dir" != "$DATA_DIR" -a -d "$ib_undo_dir" ] + then cd "$ib_undo_dir" payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') @@ -451,7 +453,7 @@ get_footprint() wsrep_log_info \ "SST footprint estimate: data: $payload_data, undo: $payload_undo" - payload=$(( payload_data + payload_undo )) + payload=$(( payload_data+payload_undo )) if [ "$compress" != 'none' ]; then # QuickLZ has around 50% compression ratio @@ -1220,13 +1222,16 @@ else # joiner INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") fi - if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' ]; then + if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ + "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] + then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" cd "$INNODB_DATA_HOME_DIR" ib_home_dir="$(pwd)" cd "$OLD_PWD" + [ "$ib_home_dir" = "$DATA_DIR" ] && ib_home_dir="" fi # if no command line argument and INNODB_LOG_GROUP_HOME is not set, @@ -1236,13 +1241,16 @@ else # joiner INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") fi - if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' ]; then + if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ + "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] + then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" cd "$INNODB_LOG_GROUP_HOME" ib_log_dir="$(pwd)" cd "$OLD_PWD" + [ "$ib_log_dir" = "$DATA_DIR" ] && ib_log_dir="" fi # if no command line argument and INNODB_UNDO_DIR is not set, @@ -1252,13 +1260,34 @@ else # joiner INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") fi - if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; then + if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ + "$INNODB_UNDO_DIR" != "$DATA_DIR" ] + then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" cd "$INNODB_UNDO_DIR" ib_undo_dir="$(pwd)" cd "$OLD_PWD" + [ "$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 @@ -1400,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 @@ -1500,11 +1531,15 @@ else # joiner binlogs=$(ls -d -1 "$binlog_base".[0-9]* 2>/dev/null || :) fi cd "$DATA_DIR" - if [ -n "$binlog_dir" -a "$binlog_dir" != '.' ]; then + if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ + "$binlog_dir" != "$DATA_DIR" ] + then [ ! -d "$binlog_dir" ] && mkdir -p "$binlog_dir" fi index_dir=$(dirname "$binlog_index"); - if [ -n "$index_dir" -a "$index_dir" != '.' ]; then + if [ -n "$index_dir" -a "$index_dir" != '.' -a \ + "$index_dir" != "$DATA_DIR" ] + then [ ! -d "$index_dir" ] && mkdir -p "$index_dir" fi if [ -n "$binlogs" ]; then diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 11b444468c8..a7c2688df76 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" @@ -185,7 +186,9 @@ if [ -z "$INNODB_LOG_GROUP_HOME" ]; then INNODB_LOG_GROUP_HOME=$(trim_dir "$INNODB_LOG_GROUP_HOME") fi -if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' ]; then +if [ -n "$INNODB_LOG_GROUP_HOME" -a "$INNODB_LOG_GROUP_HOME" != '.' -a \ + "$INNODB_LOG_GROUP_HOME" != "$DATA_DIR" ] +then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_LOG_GROUP_HOME" ] && mkdir -p "$INNODB_LOG_GROUP_HOME" @@ -201,7 +204,9 @@ if [ -z "$INNODB_DATA_HOME_DIR" ]; then INNODB_DATA_HOME_DIR=$(trim_dir "$INNODB_DATA_HOME_DIR") fi -if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' ]; then +if [ -n "$INNODB_DATA_HOME_DIR" -a "$INNODB_DATA_HOME_DIR" != '.' -a \ + "$INNODB_DATA_HOME_DIR" != "$DATA_DIR" ] +then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_DATA_HOME_DIR" ] && mkdir -p "$INNODB_DATA_HOME_DIR" @@ -217,7 +222,9 @@ if [ -z "$INNODB_UNDO_DIR" ]; then INNODB_UNDO_DIR=$(trim_dir "$INNODB_UNDO_DIR") fi -if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; then +if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' -a \ + "$INNODB_UNDO_DIR" != "$DATA_DIR" ] +then # handle both relative and absolute paths: cd "$DATA" [ ! -d "$INNODB_UNDO_DIR" ] && mkdir -p "$INNODB_UNDO_DIR" @@ -226,6 +233,23 @@ if [ -n "$INNODB_UNDO_DIR" -a "$INNODB_UNDO_DIR" != '.' ]; 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 @@ -504,7 +528,9 @@ EOF if [ "$first" = '-' -o "$first" = '@' ]; then bin_base="./$bin_base" fi - if [ -n "$bin_dir" -a "$bin_dir" != '.' ]; then + if [ -n "$bin_dir" -a "$bin_dir" != '.' -a \ + "$bin_dir" != "$DATA_DIR" ] + then tar $tar_options "$BINLOG_TAR_FILE" \ -C "$bin_dir" "$bin_base" >&2 else @@ -541,7 +567,10 @@ FILTER="-f '- /lost+found' -f '+ /wsrep_sst_binlog.tar' -f '- $ib_home_dir/ib_lru_dump' -f '- $ib_home_dir/ibdata*' - -f '+ $ib_undo_dir/undo*' + -f '- $ib_undo_dir/undo*' + -f '- $ib_log_dir/ib_logfile[0-9]*' + -f '- $ar_log_dir/aria_log_control' + -f '- $ar_log_dir/aria_log.*' -f '+ /*/' -f '- /*'" @@ -587,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 the InnoDB log file rsync ${STUNNEL:+--rsh="$STUNNEL"} \ --owner --group --perms --links --specials \ --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT -f '+ /ib_logfile0' -f '+ /aria_log.*' \ - -f '+ /aria_log_control' -f '- **' "$ib_log_dir/" \ + $WHOLE_FILE_OPT -f '+ /ib_logfile0' \ + -f '- **' "$ib_log_dir/" \ "rsync://$WSREP_SST_OPT_ADDR-log_dir" >&2 || RC=$? if [ $RC -ne 0 ]; then @@ -600,26 +629,61 @@ 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"} \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --dirs --delete --quiet \ + $WHOLE_FILE_OPT -f '+ /undo*' \ + -f '- **' "$ib_undo_dir/" \ + "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? + + if [ $RC -ne 0 ]; then + wsrep_log_error "rsync innodb_undo_dir returned code $RC:" + exit 255 # unknown error + fi + + 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: - cd "$DATA" - backup_threads=$(parse_cnf '--mysqld|sst' 'backup-threads') if [ -z "$backup_threads" ]; then get_proc backup_threads=$nproc fi + cd "$DATA" + find . -maxdepth 1 -mindepth 1 -type d -not -name 'lost+found' \ -not -name '.zfs' -print0 | xargs -I{} -0 -P $backup_threads \ rsync ${STUNNEL:+--rsh="$STUNNEL"} \ --owner --group --perms --links --specials --ignore-times \ --inplace --recursive --delete --quiet $WHOLE_FILE_OPT \ - --exclude '*/ib_logfile*' --exclude '*/aria_log.*' \ - --exclude '*/aria_log_control' "$WSREP_SST_OPT_DATA/{}/" \ + -f '- $ib_home_dir/ib_lru_dump' \ + -f '- $ib_home_dir/ibdata*' \ + -f '- $ib_undo_dir/undo*' \ + -f '- $ib_log_dir/ib_logfile[0-9]*' \ + -f '- $ar_log_dir/aria_log_control' \ + -f '- $ar_log_dir/aria_log.*' \ + "$WSREP_SST_OPT_DATA/{}/" \ "rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$? cd "$OLD_PWD" @@ -707,6 +771,10 @@ $SILENT path = $ib_log_dir [$MODULE-data_dir] 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: @@ -872,7 +940,7 @@ EOF binlog_cd=0 # Change the directory to binlog base (if possible): if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ - -d "$binlog_dir" ] + "$binlog_dir" != "$DATA_DIR" -a -d "$binlog_dir" ] then binlog_cd=1 cd "$binlog_dir" @@ -891,11 +959,15 @@ EOF tmpfile=$(TMPDIR="$tmpdir"; mktemp) fi index_dir=$(dirname "$binlog_index"); - if [ -n "$index_dir" -a "$index_dir" != '.' ]; then + if [ -n "$index_dir" -a "$index_dir" != '.' -a \ + "$index_dir" != "$DATA_DIR" ] + then [ ! -d "$index_dir" ] && mkdir -p "$index_dir" fi binlog_cd=0 - if [ -n "$binlog_dir" -a "$binlog_dir" != '.' ]; then + if [ -n "$binlog_dir" -a "$binlog_dir" != '.' -a \ + "$binlog_dir" != "$DATA_DIR" ] + then [ ! -d "$binlog_dir" ] && mkdir -p "$binlog_dir" binlog_cd=1 cd "$binlog_dir" |