Commit 81f94c26 authored by Julius Goryavsky's avatar Julius Goryavsky

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).
parent 5c75ba9c
...@@ -295,7 +295,7 @@ case "$1" in ...@@ -295,7 +295,7 @@ case "$1" in
value="$1" value="$1"
fi fi
fi fi
if [ $option == 'h' ]; then if [ $option = 'h' ]; then
if [ -z "$WSREP_SST_OPT_DATA" ]; then if [ -z "$WSREP_SST_OPT_DATA" ]; then
MYSQLD_OPT_DATADIR="${value%/}" MYSQLD_OPT_DATADIR="${value%/}"
fi fi
......
...@@ -55,7 +55,7 @@ ib_home_dir="" ...@@ -55,7 +55,7 @@ ib_home_dir=""
ib_log_dir="" ib_log_dir=""
ib_undo_dir="" ib_undo_dir=""
sfmt="tar" sfmt=""
strmcmd="" strmcmd=""
tfmt="" tfmt=""
tcmd="" tcmd=""
...@@ -97,7 +97,6 @@ if [ ! -x "$MARIABACKUP_BIN" ]; then ...@@ -97,7 +97,6 @@ if [ ! -x "$MARIABACKUP_BIN" ]; then
wsrep_log_error 'mariabackup binary not found in $PATH' wsrep_log_error 'mariabackup binary not found in $PATH'
exit 42 exit 42
fi fi
MBSTREAM_BIN=mbstream
DATA="$WSREP_SST_OPT_DATA" DATA="$WSREP_SST_OPT_DATA"
INFO_FILE="xtrabackup_galera_info" INFO_FILE="xtrabackup_galera_info"
...@@ -481,21 +480,26 @@ read_cnf() ...@@ -481,21 +480,26 @@ read_cnf()
get_stream() get_stream()
{ {
if [ "$sfmt" = 'mbstream' -o "$sfmt" = 'xbstream' ]; then 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 if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
strmcmd="$MBSTREAM_BIN -x" strmcmd="'$MBSTREAM_BIN' -x"
else else
strmcmd="$MBSTREAM_BIN -c '$INFO_FILE'" strmcmd="'$MBSTREAM_BIN' -c '$INFO_FILE'"
fi fi
else else
sfmt="tar" sfmt='tar'
wsrep_log_info "Streaming with tar" if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]]; then strmcmd='tar xfi -'
strmcmd="tar xfi -"
else else
strmcmd="tar cf - '$INFO_FILE'" strmcmd="tar cf - '$INFO_FILE'"
fi fi
fi fi
wsrep_log_info "Streaming with $sfmt"
} }
get_proc() get_proc()
...@@ -930,7 +934,7 @@ setup_commands() ...@@ -930,7 +934,7 @@ setup_commands()
fi fi
INNOAPPLY="$MARIABACKUP_BIN --prepare $disver $iapts $INNOEXTRA --target-dir='$DATA' --datadir='$DATA' $mysqld_args $INNOAPPLY" 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" 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 get_stream
......
...@@ -48,7 +48,7 @@ ib_home_dir="" ...@@ -48,7 +48,7 @@ ib_home_dir=""
ib_log_dir="" ib_log_dir=""
ib_undo_dir="" ib_undo_dir=""
sfmt="tar" sfmt=""
strmcmd="" strmcmd=""
tfmt="" tfmt=""
tcmd="" tcmd=""
...@@ -489,22 +489,28 @@ read_cnf() ...@@ -489,22 +489,28 @@ read_cnf()
get_stream() get_stream()
{ {
if [[ $sfmt == 'xbstream' ]];then if [ "$sfmt" = 'mbstream' -o "$sfmt" = 'xbstream' ]; then
wsrep_log_info "Streaming with xbstream" XBSTREAM_BIN=$(command -v "$sfmt")
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then if [ -z "$XBSTREAM_BIN" ]; then
strmcmd="xbstream -x" 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 else
strmcmd="xbstream -c '${INFO_FILE}'" strmcmd="'$XBSTREAM_BIN' -c '$INFO_FILE'"
fi fi
else else
sfmt="tar" sfmt='tar'
wsrep_log_info "Streaming with tar" if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then strmcmd='tar xfi -'
strmcmd="tar xfi -"
else else
strmcmd="tar cf - '${INFO_FILE}'" strmcmd="tar cf - '$INFO_FILE'"
fi fi
fi fi
wsrep_log_info "Streaming with $sfmt"
} }
get_proc() get_proc()
...@@ -575,7 +581,6 @@ cleanup_donor() ...@@ -575,7 +581,6 @@ cleanup_donor()
wsrep_log_error "xtrabackup process is still running. Killing... " wsrep_log_error "xtrabackup process is still running. Killing... "
kill_xtrabackup kill_xtrabackup
fi fi
fi fi
rm -f "${DATA}/${IST_FILE}" || true rm -f "${DATA}/${IST_FILE}" || true
...@@ -852,7 +857,11 @@ cd "$OLD_PWD" ...@@ -852,7 +857,11 @@ cd "$OLD_PWD"
setup_commands () { setup_commands () {
INNOAPPLY="$INNOBACKUPEX_BIN $disver $iapts $INNOEXTRA --apply-log $rebuildcmd '$DATA' $INNOAPPLY" 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" 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" ] if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
......
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