diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/galera_new_cluster.sh | 3 | ||||
-rw-r--r-- | scripts/galera_recovery.sh | 3 | ||||
-rw-r--r-- | scripts/wsrep_sst_common.sh | 10 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 41 |
4 files changed, 42 insertions, 15 deletions
diff --git a/scripts/galera_new_cluster.sh b/scripts/galera_new_cluster.sh index 8bf2fa35cec..837e3e29942 100755 --- a/scripts/galera_new_cluster.sh +++ b/scripts/galera_new_cluster.sh @@ -21,9 +21,6 @@ EOF exit 0 fi -VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@" -COMPILATION_COMMENT="@COMPILATION_COMMENT@" - systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster' && \ systemctl start ${1:-mariadb} diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 09de6721762..c58f3d8f6b9 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -107,8 +107,7 @@ else log "WSREP: mktemp failed" fi -parse_arguments `$print_defaults $cmdline_args --loose-verbose \ - mariadb mariadb_safe mysqld mysqld_safe safe_mysqld galera` +parse_arguments `$print_defaults $cmdline_args --loose-verbose --mysqld` # Perform wsrep position recovery if wsrep_on=1, skip otherwise. if [ "$wsrep_on" -eq 1 ]; then diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index b489e99e647..b3969af10a2 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:-} @@ -125,6 +126,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 @@ -138,6 +143,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 @@ -282,8 +288,8 @@ parse_cnf() reval=$($MY_PRINT_DEFAULTS "${group}" | awk -v var="${var}" 'BEGIN { OFS=FS="=" } { gsub(/_/,"-",$1); if ( $1=="--"var) lastval=substr($0,length($1)+2) } END { print lastval}') # use default if we haven't found a value - if [ -z $reval ]; then - [ -n $3 ] && reval=$3 + if [ -z "$reval" ]; then + [ -n "$3" ] && reval=$3 fi echo $reval } diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index a70c89d0b1f..31137547eea 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:-""} @@ -217,19 +225,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 @@ -283,7 +301,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) @@ -297,7 +316,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:" @@ -427,7 +446,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 @@ -436,10 +457,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 |