summaryrefslogtreecommitdiff
path: root/scripts/wsrep_sst_rsync.sh
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-06-26 12:56:19 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2018-09-05 10:34:36 +0300
commitb44b9f71bd86076746d21babb17949c1a710343c (patch)
tree8846d0871149780773d07fe0f8f59393e02e4132 /scripts/wsrep_sst_rsync.sh
parent4caf3e08a853e413b4a08c1bf93cf737266a1451 (diff)
downloadmariadb-git-b44b9f71bd86076746d21babb17949c1a710343c.tar.gz
MDEV-15436: If log_bin and log_bin_index is different SST with rsync fails.
Problem was that in SST log_bin_index name and directory was not handled and passed to rsync SST script. wsrep_sst_common.sh Read binlog index dirname and filename if --binlog-index parameter is provided. Read binlog filenames from that file from donor and write transfered binlog filenames to that file in joiner. mysqld.cc, mysqld.h Moved opt_binlog_index_name from static to global and added it to extern. wsrep_sst.cc generate_binlog_index_opt_val New function to generate binlog index name if opt_binlog_index_name is given on configuration. sst_prepare_other Add binlog index configuration to SST command. wsrep_sst.h Add new SST parameter --binlog-index Add test case.
Diffstat (limited to 'scripts/wsrep_sst_rsync.sh')
-rw-r--r--scripts/wsrep_sst_rsync.sh41
1 files changed, 33 insertions, 8 deletions
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 77a25ffc530..c01e7c1d390 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -105,6 +105,14 @@ if ! [ -z $WSREP_SST_OPT_BINLOG ]
then
BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
+ BINLOG_INDEX_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG)
+ BINLOG_INDEX_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
+fi
+
+if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
+then
+ BINLOG_INDEX_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG_INDEX)
+ BINLOG_INDEX_FILENAME=$(basename $WSREP_SST_OPT_BINLOG_INDEX)
fi
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
@@ -210,19 +218,29 @@ EOF
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)
+ OLD_PWD="$(pwd)"
+ cd $BINLOG_DIRNAME
+
+ if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
+ binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
+ then
+ cd $BINLOG_INDEX_DIRNAME
+ binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_INDEX_FILENAME}.index)
+ fi
+
+ cd $BINLOG_DIRNAME
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
+ cd "$OLD_PWD"
fi
# first, the normal directories, so that we can detect incompatible protocol
@@ -276,7 +294,8 @@ EOF
fi
# then, we parallelize the transfer of database directories, use . so that pathconcatenation works
- pushd "$WSREP_SST_OPT_DATA" >/dev/null
+ OLD_PWD="$(pwd)"
+ cd $WSREP_SST_OPT_DATA
count=1
[ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
@@ -290,7 +309,7 @@ EOF
$WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \
rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$?
- popd >/dev/null
+ cd "$OLD_PWD"
if [ $RC -ne 0 ]; then
wsrep_log_error "find/rsync returned code $RC:"
@@ -420,7 +439,9 @@ EOF
if ! [ -z $WSREP_SST_OPT_BINLOG ]
then
- pushd $BINLOG_DIRNAME &> /dev/null
+ OLD_PWD="$(pwd)"
+ cd $BINLOG_DIRNAME
+
if [ -f $BINLOG_TAR_FILE ]
then
# Clean up old binlog files first
@@ -429,10 +450,14 @@ EOF
tar -xvf $BINLOG_TAR_FILE >&2
for ii in $(ls -1 ${BINLOG_FILENAME}.*)
do
- echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
+ if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
+ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
+ then
+ echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
+ fi
done
fi
- popd &> /dev/null
+ cd "$OLD_PWD"
fi
if [ -r "$MAGIC_FILE" ]
then