diff options
author | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2021-05-24 16:48:27 +0200 |
---|---|---|
committer | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2021-05-24 16:48:27 +0200 |
commit | 81f94c26a4fb60345e260ba25f39315f3d9a6f3b (patch) | |
tree | 1aa19647894450efdf8ffd31da0b4a49130cc8e4 /scripts | |
parent | 5c75ba9cadc7877e91d6b712f157ff5623c09c60 (diff) | |
download | mariadb-git-81f94c26a4fb60345e260ba25f39315f3d9a6f3b.tar.gz |
MDEV-15730: rename --stream=xbstream to --stream=mbstream
mbstream is already supported as a format name after MDEV-24580,
but additional code refactoring has been done to correctly display
the format name in log files and to check if the mbstream utility
is in the path. Also, for xtrabackup-v2 (only available in the 10.2)
both utilities are supported - both xbstram and mbstream, since they
are interchangeable in this context. In this case, the original
innobackupex always receives the correct --stream=xbstream option
as input, but the user can actually try to use the mbstream utility
during the transfer (if the user explicitly specifies this in the
configuration file).
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/wsrep_sst_common.sh | 2 | ||||
-rw-r--r-- | scripts/wsrep_sst_mariabackup.sh | 24 | ||||
-rw-r--r-- | scripts/wsrep_sst_xtrabackup-v2.sh | 35 |
3 files changed, 37 insertions, 24 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 952a37f75d2..ceab62b4c56 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -295,7 +295,7 @@ case "$1" in value="$1" fi fi - if [ $option == 'h' ]; then + if [ $option = 'h' ]; then if [ -z "$WSREP_SST_OPT_DATA" ]; then MYSQLD_OPT_DATADIR="${value%/}" fi diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 5618c704dbc..530d3e49256 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -55,7 +55,7 @@ ib_home_dir="" ib_log_dir="" ib_undo_dir="" -sfmt="tar" +sfmt="" strmcmd="" tfmt="" tcmd="" @@ -97,7 +97,6 @@ if [ ! -x "$MARIABACKUP_BIN" ]; then wsrep_log_error 'mariabackup binary not found in $PATH' exit 42 fi -MBSTREAM_BIN=mbstream DATA="$WSREP_SST_OPT_DATA" INFO_FILE="xtrabackup_galera_info" @@ -481,21 +480,26 @@ read_cnf() get_stream() { if [ "$sfmt" = 'mbstream' -o "$sfmt" = 'xbstream' ]; then - wsrep_log_info "Streaming with ${sfmt}" + sfmt='mbstream' + MBSTREAM_BIN="$(command -v mbstream)" + if [ -z "$MBSTREAM_BIN" ]; then + wsrep_log_error "Streaming with $sfmt, but $sfmt not found in path" + exit 42 + fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then - strmcmd="$MBSTREAM_BIN -x" + strmcmd="'$MBSTREAM_BIN' -x" else - strmcmd="$MBSTREAM_BIN -c '$INFO_FILE'" + strmcmd="'$MBSTREAM_BIN' -c '$INFO_FILE'" fi else - sfmt="tar" - wsrep_log_info "Streaming with tar" - if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]]; then - strmcmd="tar xfi -" + sfmt='tar' + if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then + strmcmd='tar xfi -' else strmcmd="tar cf - '$INFO_FILE'" fi fi + wsrep_log_info "Streaming with $sfmt" } get_proc() @@ -930,7 +934,7 @@ setup_commands() fi INNOAPPLY="$MARIABACKUP_BIN --prepare $disver $iapts $INNOEXTRA --target-dir='$DATA' --datadir='$DATA' $mysqld_args $INNOAPPLY" INNOMOVE="$MARIABACKUP_BIN $WSREP_SST_OPT_CONF --move-back $disver $impts --force-non-empty-directories --target-dir='$DATA' --datadir='${TDATA:-$DATA}' $INNOMOVE" - INNOBACKUP="$MARIABACKUP_BIN $WSREP_SST_OPT_CONF --backup $disver $iopts $tmpopts $INNOEXTRA --galera-info --stream='$sfmt' --target-dir='$itmpdir' --datadir='$DATA' $mysqld_args $INNOBACKUP" + INNOBACKUP="$MARIABACKUP_BIN $WSREP_SST_OPT_CONF --backup $disver $iopts $tmpopts $INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA' $mysqld_args $INNOBACKUP" } get_stream diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index 2eef6c661a5..b0d5c0aedf1 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -48,7 +48,7 @@ ib_home_dir="" ib_log_dir="" ib_undo_dir="" -sfmt="tar" +sfmt="" strmcmd="" tfmt="" tcmd="" @@ -489,22 +489,28 @@ read_cnf() get_stream() { - if [[ $sfmt == 'xbstream' ]];then - wsrep_log_info "Streaming with xbstream" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="xbstream -x" + if [ "$sfmt" = 'mbstream' -o "$sfmt" = 'xbstream' ]; then + XBSTREAM_BIN=$(command -v "$sfmt") + if [ -z "$XBSTREAM_BIN" ]; then + if [ -z "$XBSTREAM_BIN" ]; then + wsrep_log_error "Streaming with $sfmt, but $sfmt not found in path" + exit 42 + fi + fi + if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then + strmcmd="'$XBSTREAM_BIN' -x" else - strmcmd="xbstream -c '${INFO_FILE}'" + strmcmd="'$XBSTREAM_BIN' -c '$INFO_FILE'" fi else - sfmt="tar" - wsrep_log_info "Streaming with tar" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="tar xfi -" + sfmt='tar' + if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then + strmcmd='tar xfi -' else - strmcmd="tar cf - '${INFO_FILE}'" + strmcmd="tar cf - '$INFO_FILE'" fi fi + wsrep_log_info "Streaming with $sfmt" } get_proc() @@ -575,7 +581,6 @@ cleanup_donor() wsrep_log_error "xtrabackup process is still running. Killing... " kill_xtrabackup fi - fi rm -f "${DATA}/${IST_FILE}" || true @@ -852,7 +857,11 @@ cd "$OLD_PWD" setup_commands () { INNOAPPLY="$INNOBACKUPEX_BIN $disver $iapts $INNOEXTRA --apply-log $rebuildcmd '$DATA' $INNOAPPLY" INNOMOVE="$INNOBACKUPEX_BIN $WSREP_SST_OPT_CONF $disver $impts --move-back --force-non-empty-directories '$DATA' $INNOMOVE" - INNOBACKUP="$INNOBACKUPEX_BIN $WSREP_SST_OPT_CONF $disver $iopts $tmpopts $INNOEXTRA --galera-info --stream='$sfmt' '$itmpdir' $INNOBACKUP" + sfmt_work="$sfmt" + if [ "$sfmt" = 'mbstream' ]; then + sfmt_work='xbstream' + fi + INNOBACKUP="$INNOBACKUPEX_BIN $WSREP_SST_OPT_CONF $disver $iopts $tmpopts $INNOEXTRA --galera-info --stream=$sfmt_work '$itmpdir' $INNOBACKUP" } if [ "$WSREP_SST_OPT_ROLE" = "donor" ] |