Skip to content
Permalink
Browse files
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).
  • Loading branch information
sysprg committed May 24, 2021
1 parent 5c75ba9 commit 81f94c2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 24 deletions.
@@ -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
@@ -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
@@ -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" ]

0 comments on commit 81f94c2

Please sign in to comment.