diff options
author | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2022-09-15 05:33:08 +0200 |
---|---|---|
committer | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2022-09-27 13:53:00 +0200 |
commit | d335ed91631ec0190dc2fdf2916313c9585c0ff2 (patch) | |
tree | 1f38b97979c08d33599cae5642526fda807dd7db | |
parent | 96b51bd23d303def6edb4d2fe26c025c6625b3de (diff) | |
download | mariadb-git-d335ed91631ec0190dc2fdf2916313c9585c0ff2.tar.gz |
MDEV-28669: Aria-related changes
-rw-r--r-- | scripts/wsrep_sst_common.sh | 19 | ||||
-rw-r--r-- | scripts/wsrep_sst_mariabackup.sh | 20 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 74 |
3 files changed, 97 insertions, 16 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..138986e0798 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,23 @@ 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" + fi + if [ -n "$backup_threads" ]; then impts="--parallel=$backup_threads${impts:+ }$impts" fi @@ -1410,12 +1428,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 2c32c6b0125..e6cb1b0ecc6 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.*' - -f '- $ib_log_dir/aria_log_control' + -f '- $ar_log_dir/aria_log_control' + -f '- $ar_log_dir/aria_log.*' -f '+ /*/' -f '- /*'" @@ -586,7 +604,7 @@ FILTER="-f '- /lost+found' # Transfer InnoDB data files rsync ${STUNNEL:+--rsh="$STUNNEL"} \ --owner --group --perms --links --specials \ - --ignore-times --inplace --dirs --delete --quiet \ + --ignore-times --inplace --quiet --dirs --delete \ $WHOLE_FILE_OPT -f '+ /ibdata*' -f '+ /ib_lru_dump' \ -f '- **' "$ib_home_dir/" \ "rsync://$WSREP_SST_OPT_ADDR-data_dir" >&2 || RC=$? @@ -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/" \ + --ignore-times --inplace --quiet --dirs --delete \ + $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,13 +629,14 @@ 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/" \ + --ignore-times --inplace --quiet --dirs --delete \ + $WHOLE_FILE_OPT -f '+ /undo*' \ + -f '- **' "$ib_undo_dir/" \ "rsync://$WSREP_SST_OPT_ADDR-undo_dir" >&2 || RC=$? if [ $RC -ne 0 ]; then @@ -627,24 +646,45 @@ 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 --quiet --dirs --delete \ + $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/{}/" \ + --owner --group --perms --links --specials \ + --ignore-times --inplace --recursive --delete --quiet \ + $WHOLE_FILE_OPT \ + -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" @@ -734,6 +774,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: |