mirror of
https://github.com/MariaDB/server.git
synced 2025-05-25 13:42:52 +03:00
Going more MTR-friendly - for SST prefer to use mysql client, mysqldump and my_print_defaults from the local build tree.
This commit is contained in:
parent
2a6e1230e3
commit
822c00536d
@ -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
|
||||
|
@ -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
|
||||
|
@ -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- )
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user