diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/wsrep_sst_common.sh | 6 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 41 |
2 files changed, 39 insertions, 8 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index bc26cec6d83..4ecfc245ec5 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -20,6 +20,7 @@ set -u WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_BINLOG="" +WSREP_SST_OPT_BINLOG_INDEX="" WSREP_SST_OPT_DATA="" WSREP_SST_OPT_AUTH=${WSREP_SST_OPT_AUTH:-} WSREP_SST_OPT_USER=${WSREP_SST_OPT_USER:-} @@ -120,6 +121,10 @@ case "$1" in WSREP_SST_OPT_BINLOG="$2" shift ;; + '--binlog-index') + WSREP_SST_OPT_BINLOG_INDEX="$2" + shift + ;; '--gtid-domain-id') readonly WSREP_SST_OPT_GTID_DOMAIN_ID="$2" shift @@ -133,6 +138,7 @@ shift done readonly WSREP_SST_OPT_BYPASS readonly WSREP_SST_OPT_BINLOG +readonly WSREP_SST_OPT_BINLOG_INDEX if [ -n "${WSREP_SST_OPT_ADDR_PORT:-}" ]; then if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then 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 |