Commit 2f0e7f66 authored by Julius Goryavsky's avatar Julius Goryavsky

galera: syncing SST scripts code with the following versions

parent 1001dae1
...@@ -152,7 +152,6 @@ WSREP_SST_OPT_DATA="" ...@@ -152,7 +152,6 @@ WSREP_SST_OPT_DATA=""
WSREP_SST_OPT_AUTH="${WSREP_SST_OPT_AUTH:-}" WSREP_SST_OPT_AUTH="${WSREP_SST_OPT_AUTH:-}"
WSREP_SST_OPT_USER="${WSREP_SST_OPT_USER:-}" WSREP_SST_OPT_USER="${WSREP_SST_OPT_USER:-}"
WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_PSWD:-}" WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_PSWD:-}"
WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}"
WSREP_SST_OPT_DEFAULT="" WSREP_SST_OPT_DEFAULT=""
WSREP_SST_OPT_DEFAULTS="" WSREP_SST_OPT_DEFAULTS=""
WSREP_SST_OPT_EXTRA_DEFAULT="" WSREP_SST_OPT_EXTRA_DEFAULT=""
...@@ -1008,11 +1007,6 @@ in_config() ...@@ -1008,11 +1007,6 @@ in_config()
echo $found echo $found
} }
wsrep_auth_not_set()
{
[ -z "$WSREP_SST_OPT_AUTH" ]
}
# Get rid of incorrect values resulting from substitution # Get rid of incorrect values resulting from substitution
# in programs external to the script: # in programs external to the script:
if [ "$WSREP_SST_OPT_USER" = '(null)' ]; then if [ "$WSREP_SST_OPT_USER" = '(null)' ]; then
...@@ -1028,12 +1022,12 @@ fi ...@@ -1028,12 +1022,12 @@ fi
# Let's read the value of the authentication string from the # Let's read the value of the authentication string from the
# configuration file so that it does not go to the command line # configuration file so that it does not go to the command line
# and does not appear in the ps output: # and does not appear in the ps output:
if wsrep_auth_not_set; then if [ -z "$WSREP_SST_OPT_AUTH" ]; then
WSREP_SST_OPT_AUTH=$(parse_cnf 'sst' 'wsrep-sst-auth') WSREP_SST_OPT_AUTH=$(parse_cnf 'sst' 'wsrep-sst-auth')
fi fi
# Splitting WSREP_SST_OPT_AUTH as "user:password" pair: # Splitting WSREP_SST_OPT_AUTH as "user:password" pair:
if ! wsrep_auth_not_set; then if [ -n "$WSREP_SST_OPT_AUTH" ]; then
# Extract username as shortest prefix up to first ':' character: # Extract username as shortest prefix up to first ':' character:
WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}" WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}"
if [ -z "$WSREP_SST_OPT_USER" ]; then if [ -z "$WSREP_SST_OPT_USER" ]; then
...@@ -1057,19 +1051,20 @@ if ! wsrep_auth_not_set; then ...@@ -1057,19 +1051,20 @@ if ! wsrep_auth_not_set; then
fi fi
fi fi
readonly WSREP_SST_OPT_USER WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}"
readonly WSREP_SST_OPT_PSWD WSREP_SST_OPT_REMOTE_USER=
readonly WSREP_SST_OPT_AUTH WSREP_SST_OPT_REMOTE_PSWD=
if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then
# Split auth string at the last ':' # Split auth string at the last ':'
readonly WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}" WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}"
readonly WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}" WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}"
else
readonly WSREP_SST_OPT_REMOTE_USER=
readonly WSREP_SST_OPT_REMOTE_PSWD=
fi fi
readonly WSREP_SST_OPT_USER
readonly WSREP_SST_OPT_PSWD
readonly WSREP_SST_OPT_AUTH
readonly WSREP_SST_OPT_REMOTE_USER
readonly WSREP_SST_OPT_REMOTE_PSWD
readonly WSREP_SST_OPT_REMOTE_AUTH readonly WSREP_SST_OPT_REMOTE_AUTH
if [ -n "$WSREP_SST_OPT_DATA" ]; then if [ -n "$WSREP_SST_OPT_DATA" ]; then
......
...@@ -1100,15 +1100,13 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then ...@@ -1100,15 +1100,13 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
wsrep_log_info "Using '$itmpdir' as mariadb-backup working directory" wsrep_log_info "Using '$itmpdir' as mariadb-backup working directory"
usrst=0
if [ -n "$WSREP_SST_OPT_USER" ]; then if [ -n "$WSREP_SST_OPT_USER" ]; then
INNOEXTRA="$INNOEXTRA --user='$WSREP_SST_OPT_USER'" INNOEXTRA="$INNOEXTRA --user='$WSREP_SST_OPT_USER'"
usrst=1
fi fi
if [ -n "$WSREP_SST_OPT_PSWD" ]; then if [ -n "$WSREP_SST_OPT_PSWD" ]; then
export MYSQL_PWD="$WSREP_SST_OPT_PSWD" export MYSQL_PWD="$WSREP_SST_OPT_PSWD"
elif [ $usrst -eq 1 ]; then elif [ -n "$WSREP_SST_OPT_USER" ]; then
# Empty password, used for testing, debugging etc. # Empty password, used for testing, debugging etc.
unset MYSQL_PWD unset MYSQL_PWD
fi fi
......
...@@ -40,17 +40,15 @@ then ...@@ -40,17 +40,15 @@ then
fi fi
# Check client version # Check client version
if ! $MYSQL_CLIENT --version | grep -q -E 'Distrib 10\.[1-9]'; then if ! $MYSQL_CLIENT --version | grep -q -E '(Distrib 10\.[1-9])|( from 1[1-9]\.)'; then
$MYSQL_CLIENT --version >&2 $MYSQL_CLIENT --version >&2
wsrep_log_error "this operation requires MySQL client version 10.1 or newer" wsrep_log_error "this operation requires MySQL client version 10.1 or newer"
exit $EINVAL exit $EINVAL
fi fi
AUTH="" AUTH=""
usrst=0
if [ -n "$WSREP_SST_OPT_USER" ]; then if [ -n "$WSREP_SST_OPT_USER" ]; then
AUTH="-u$WSREP_SST_OPT_USER" AUTH="-u$WSREP_SST_OPT_USER"
usrst=1
fi fi
# Refs https://github.com/codership/mysql-wsrep/issues/141 # Refs https://github.com/codership/mysql-wsrep/issues/141
...@@ -64,7 +62,7 @@ fi ...@@ -64,7 +62,7 @@ fi
# word, it is arguably more secure than passing password on the command line. # word, it is arguably more secure than passing password on the command line.
if [ -n "$WSREP_SST_OPT_PSWD" ]; then if [ -n "$WSREP_SST_OPT_PSWD" ]; then
export MYSQL_PWD="$WSREP_SST_OPT_PSWD" export MYSQL_PWD="$WSREP_SST_OPT_PSWD"
elif [ $usrst -eq 1 ]; then elif [ -n "$WSREP_SST_OPT_USER" ]; then
# Empty password, used for testing, debugging etc. # Empty password, used for testing, debugging etc.
unset MYSQL_PWD unset MYSQL_PWD
fi fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment