mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV#6317: Fix rsync SST method to transfer binlog
state to the joiner * Merged changes to transfer last binlog file from codership/5.6. * Updated load default option groups.
This commit is contained in:
parent
68deb11a36
commit
cc66ae6aae
2 changed files with 49 additions and 25 deletions
|
@ -28,9 +28,6 @@ export PATH="/usr/sbin:/sbin:$PATH"
|
|||
|
||||
. $(dirname $0)/wsrep_sst_common
|
||||
|
||||
# Setting the path for lsof on CentOS
|
||||
export PATH="/usr/sbin:/sbin:$PATH"
|
||||
|
||||
wsrep_check_programs rsync
|
||||
|
||||
cleanup_joiner()
|
||||
|
@ -82,13 +79,22 @@ check_pid_and_port()
|
|||
MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
|
||||
rm -rf "$MAGIC_FILE"
|
||||
|
||||
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
|
||||
BINLOG_TAR_FILE="$WSREP_SST_OPT_DATA/wsrep_sst_binlog.tar"
|
||||
BINLOG_N_FILES=1
|
||||
rm -f "$BINLOG_TAR_FILE" || :
|
||||
|
||||
if ! [ -z $WSREP_SST_OPT_BINLOG ]
|
||||
then
|
||||
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
|
||||
BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
|
||||
fi
|
||||
|
||||
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
|
||||
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
|
||||
if [ -z "$WSREP_LOG_DIR" ]; then
|
||||
SCRIPT_DIR="$(cd $(dirname "$0"); pwd -P)"
|
||||
WSREP_LOG_DIR=$($SCRIPT_DIR/my_print_defaults --defaults-file \
|
||||
"$WSREP_SST_OPT_CONF" mysqld server mysqld-5.5 \
|
||||
"$WSREP_SST_OPT_CONF" mysqld server mysqld-10.0 mariadb mariadb-10.0 \
|
||||
| grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \
|
||||
| cut -b 29- )
|
||||
fi
|
||||
|
@ -109,7 +115,7 @@ fi
|
|||
|
||||
# New filter - exclude everything except dirs (schemas) and innodb files
|
||||
FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
|
||||
-f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*')
|
||||
-f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*')
|
||||
|
||||
if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
|
||||
then
|
||||
|
@ -138,6 +144,24 @@ then
|
|||
|
||||
sync
|
||||
|
||||
if ! [ -z $WSREP_SST_OPT_BINLOG ]
|
||||
then
|
||||
# Prepare binlog files
|
||||
pushd $BINLOG_DIRNAME &> /dev/null
|
||||
binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
|
||||
binlog_files=""
|
||||
for ii in $binlog_files_full
|
||||
do
|
||||
binlog_files="$binlog_files $(basename $ii)"
|
||||
done
|
||||
if ! [ -z "$binlog_files" ]
|
||||
then
|
||||
wsrep_log_info "Preparing binlog files for transfer:"
|
||||
tar -cvf $BINLOG_TAR_FILE $binlog_files >&2
|
||||
fi
|
||||
popd &> /dev/null
|
||||
fi
|
||||
|
||||
# first, the normal directories, so that we can detect incompatible protocol
|
||||
RC=0
|
||||
rsync --owner --group --perms --links --specials \
|
||||
|
@ -275,6 +299,23 @@ EOF
|
|||
exit 32
|
||||
fi
|
||||
|
||||
if ! [ -z $WSREP_SST_OPT_BINLOG ]
|
||||
then
|
||||
|
||||
pushd $BINLOG_DIRNAME &> /dev/null
|
||||
if [ -f $BINLOG_TAR_FILE ]
|
||||
then
|
||||
# Clean up old binlog files first
|
||||
rm -f ${BINLOG_FILENAME}.*
|
||||
wsrep_log_info "Extracting binlog files:"
|
||||
tar -xvf $BINLOG_TAR_FILE >&2
|
||||
for ii in $(ls -1 ${BINLOG_FILENAME}.*)
|
||||
do
|
||||
echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
|
||||
done
|
||||
fi
|
||||
popd &> /dev/null
|
||||
fi
|
||||
if [ -r "$MAGIC_FILE" ]
|
||||
then
|
||||
cat "$MAGIC_FILE" # output UUID:seqno
|
||||
|
@ -289,4 +330,6 @@ else
|
|||
exit 22 # EINVAL
|
||||
fi
|
||||
|
||||
rm -f $BINLOG_TAR_FILE || :
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -15,25 +15,6 @@
|
|||
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
#############################################################################################################
|
||||
# This is a reference script for Percona XtraBackup-based state snapshot transfer #
|
||||
# Dependencies: (depending on configuration) #
|
||||
# xbcrypt for encryption/decryption. #
|
||||
# qpress for decompression. Download from http://www.quicklz.com/qpress-11-linux-x64.tar till #
|
||||
# https://blueprints.launchpad.net/percona-xtrabackup/+spec/package-qpress is fixed. #
|
||||
# my_print_defaults to extract values from my.cnf. #
|
||||
# netcat for transfer. #
|
||||
# xbstream/tar for streaming. (and xtrabackup ofc) #
|
||||
# #
|
||||
# Currently only option in cnf is read specifically for SST #
|
||||
# [sst] #
|
||||
# streamfmt=tar|xbstream #
|
||||
# #
|
||||
# Default is tar till lp:1193240 is fixed #
|
||||
# You need to use xbstream for encryption, compression etc., however, #
|
||||
# lp:1193240 requires you to manually cleanup the directory prior to SST #
|
||||
# #
|
||||
#############################################################################################################
|
||||
# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html
|
||||
# Make sure to read that before proceeding!
|
||||
|
||||
|
|
Loading…
Reference in a new issue