diff options
author | Alexey Yurchenko <ayurchen@gmail.com> | 2014-12-09 22:13:14 +0200 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-05-04 13:04:51 -0400 |
commit | 822c00536d461d56e81dd9c519ec5ec1cde9536a (patch) | |
tree | 8ae4bce142db8155aad73af4736ccfac8917c3d3 | |
parent | 2a6e1230e3a709ac91ac299ec81a18fb37538e4b (diff) | |
download | mariadb-git-822c00536d461d56e81dd9c519ec5ec1cde9536a.tar.gz |
Going more MTR-friendly - for SST prefer to use mysql client, mysqldump and my_print_defaults from the local build tree.
-rw-r--r-- | scripts/wsrep_sst_common.sh | 28 | ||||
-rw-r--r-- | scripts/wsrep_sst_mysqldump.sh | 8 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 3 | ||||
-rw-r--r-- | scripts/wsrep_sst_xtrabackup-v2.sh | 10 | ||||
-rw-r--r-- | scripts/wsrep_sst_xtrabackup.sh | 10 |
5 files changed, 42 insertions, 17 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index d9aa24169ce..2546074f7bd 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -88,8 +88,34 @@ shift done readonly WSREP_SST_OPT_BYPASS +# try to use my_print_defaults, mysql and mysqldump that come with the sources +# (for MTR suite) +SCRIPTS_DIR="$(cd $(dirname "$0"); pwd -P)" +EXTRA_DIR="$SCRIPTS_DIR/../extra" +CLIENT_DIR="$SCRIPTS_DIR/../client" + +if [ -x "$CLIENT_DIR/mysql" ]; then + MYSQL_CLIENT="$CLIENT_DIR/mysql" +else + MYSQL_CLIENT=$(which mysql) +fi + +if [ -x "$CLIENT_DIR/mysqldump" ]; then + MYSQLDUMP="$CLIENT_DIR/mysqldump" +else + MYSQLDUMP=$(which mysqldump) +fi + +if [ -x "$SCRIPTS_DIR/my_print_defaults" ]; then + MY_PRINT_DEFAULTS="$SCRIPTS_DIR/my_print_defaults" +elif [ -x "$EXTRA_DIR/my_print_defaults" ]; then + MY_PRINT_DEFAULTS="$EXTRA_DIR/my_print_defaults" +else + MY_PRINT_DEFAULTS=$(which my_print_defaults) +fi + # For Bug:1200727 -if my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then +if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then if [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ];then WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2) fi diff --git a/scripts/wsrep_sst_mysqldump.sh b/scripts/wsrep_sst_mysqldump.sh index 3db1d73bb9c..53371765f66 100644 --- a/scripts/wsrep_sst_mysqldump.sh +++ b/scripts/wsrep_sst_mysqldump.sh @@ -54,9 +54,9 @@ then fi # Check client version -if ! mysql --version | grep 'Distrib 5.5' >/dev/null +if ! $MYSQL_CLIENT --version | grep 'Distrib 5.5' >/dev/null then - mysql --version >&2 + $MYSQL_CLIENT --version >&2 wsrep_log_error "this operation requires MySQL client version 5.5.x" exit $EINVAL fi @@ -72,7 +72,7 @@ if test -n "$WSREP_SST_OPT_PSWD"; then AUTH="$AUTH -p$WSREP_SST_OPT_PSWD"; fi STOP_WSREP="SET wsrep_on=OFF;" # NOTE: we don't use --routines here because we're dumping mysql.proc table -MYSQLDUMP="mysqldump $AUTH -S$WSREP_SST_OPT_SOCKET \ +MYSQLDUMP="$MYSQLDUMP $AUTH -S$WSREP_SST_OPT_SOCKET \ --add-drop-database --add-drop-table --skip-add-locks --create-options \ --disable-keys --extended-insert --skip-lock-tables --quick --set-charset \ --skip-comments --flush-privileges --all-databases" @@ -97,7 +97,7 @@ DROP PREPARE stmt;" SET_START_POSITION="SET GLOBAL wsrep_start_position='$WSREP_SST_OPT_GTID';" -MYSQL="mysql $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ +MYSQL="$MYSQL_CLIENT $AUTH -h$WSREP_SST_OPT_HOST -P$WSREP_SST_OPT_PORT "\ "--disable-reconnect --connect_timeout=10" # need to disable logging when loading the dump diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 464b2b1ef3e..494ed4b5c02 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -83,8 +83,7 @@ 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_LOG_DIR=$($MY_PRINT_DEFAULTS --defaults-file \ "$WSREP_SST_OPT_CONF" mysqld server mysqld-5.5 mariadb mariadb-5.5 \ | grep -- '--innodb[-_]log[-_]group[-_]home[-_]dir=' \ | cut -b 29- ) diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index d80af7454fb..1a191a6ad6b 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -117,7 +117,7 @@ get_keys() fi if [[ $encrypt -eq 0 ]];then - if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " fi return @@ -230,7 +230,7 @@ parse_cnf() { local group=$1 local var=$2 - reval=$(my_print_defaults -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) + reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) if [[ -z $reval ]];then [[ -n $3 ]] && reval=$3 fi @@ -241,7 +241,7 @@ get_footprint() { pushd $WSREP_SST_OPT_DATA 1>/dev/null payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }') - if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then # QuickLZ has around 50% compression ratio # When compression/compaction used, the progress is only an approximate. payload=$(( payload*1/2 )) @@ -443,8 +443,8 @@ check_extra() { local use_socket=1 if [[ $uextra -eq 1 ]];then - if my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then - local eport=$(my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then + local eport=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) if [[ -n $eport ]];then # Xtrabackup works only locally. # Hence, setting host to 127.0.0.1 unconditionally. diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index dd4060e6961..044f9995580 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -100,7 +100,7 @@ get_keys() fi if [[ $encrypt -eq 0 ]];then - if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q encrypt;then wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " fi return @@ -195,7 +195,7 @@ parse_cnf() { local group=$1 local var=$2 - reval=$(my_print_defaults -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) + reval=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF $group | awk -F= '{if ($1 ~ /_/) { gsub(/_/,"-",$1); print $1"="$2 } else { print $0 }}' | grep -- "--$var=" | cut -d= -f2-) if [[ -z $reval ]];then [[ -n $3 ]] && reval=$3 fi @@ -206,7 +206,7 @@ get_footprint() { pushd $WSREP_SST_OPT_DATA 1>/dev/null payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c | awk 'END { print $1 }') - if my_print_defaults -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF xtrabackup | grep -q -- "--compress";then # QuickLZ has around 50% compression ratio # When compression/compaction used, the progress is only an approximate. payload=$(( payload*1/2 )) @@ -385,8 +385,8 @@ check_extra() { local use_socket=1 if [[ $uextra -eq 1 ]];then - if my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then - local eport=$(my_print_defaults -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) + if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--thread-handling=" | grep -q 'pool-of-threads';then + local eport=$($MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF mysqld | tr '_' '-' | grep -- "--extra-port=" | cut -d= -f2) if [[ -n $eport ]];then # Xtrabackup works only locally. # Hence, setting host to 127.0.0.1 unconditionally. |