Skip to content

Commit 2f0e7f6

Browse files
committed
galera: syncing SST scripts code with the following versions
1 parent 1001dae commit 2f0e7f6

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

scripts/wsrep_sst_common.sh

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ WSREP_SST_OPT_DATA=""
152152
WSREP_SST_OPT_AUTH="${WSREP_SST_OPT_AUTH:-}"
153153
WSREP_SST_OPT_USER="${WSREP_SST_OPT_USER:-}"
154154
WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_PSWD:-}"
155-
WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}"
156155
WSREP_SST_OPT_DEFAULT=""
157156
WSREP_SST_OPT_DEFAULTS=""
158157
WSREP_SST_OPT_EXTRA_DEFAULT=""
@@ -1008,11 +1007,6 @@ in_config()
10081007
echo $found
10091008
}
10101009

1011-
wsrep_auth_not_set()
1012-
{
1013-
[ -z "$WSREP_SST_OPT_AUTH" ]
1014-
}
1015-
10161010
# Get rid of incorrect values resulting from substitution
10171011
# in programs external to the script:
10181012
if [ "$WSREP_SST_OPT_USER" = '(null)' ]; then
@@ -1028,12 +1022,12 @@ fi
10281022
# Let's read the value of the authentication string from the
10291023
# configuration file so that it does not go to the command line
10301024
# and does not appear in the ps output:
1031-
if wsrep_auth_not_set; then
1025+
if [ -z "$WSREP_SST_OPT_AUTH" ]; then
10321026
WSREP_SST_OPT_AUTH=$(parse_cnf 'sst' 'wsrep-sst-auth')
10331027
fi
10341028

10351029
# Splitting WSREP_SST_OPT_AUTH as "user:password" pair:
1036-
if ! wsrep_auth_not_set; then
1030+
if [ -n "$WSREP_SST_OPT_AUTH" ]; then
10371031
# Extract username as shortest prefix up to first ':' character:
10381032
WSREP_SST_OPT_AUTH_USER="${WSREP_SST_OPT_AUTH%%:*}"
10391033
if [ -z "$WSREP_SST_OPT_USER" ]; then
@@ -1057,19 +1051,20 @@ if ! wsrep_auth_not_set; then
10571051
fi
10581052
fi
10591053

1060-
readonly WSREP_SST_OPT_USER
1061-
readonly WSREP_SST_OPT_PSWD
1062-
readonly WSREP_SST_OPT_AUTH
1063-
1054+
WSREP_SST_OPT_REMOTE_AUTH="${WSREP_SST_OPT_REMOTE_AUTH:-}"
1055+
WSREP_SST_OPT_REMOTE_USER=
1056+
WSREP_SST_OPT_REMOTE_PSWD=
10641057
if [ -n "$WSREP_SST_OPT_REMOTE_AUTH" ]; then
10651058
# Split auth string at the last ':'
1066-
readonly WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}"
1067-
readonly WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}"
1068-
else
1069-
readonly WSREP_SST_OPT_REMOTE_USER=
1070-
readonly WSREP_SST_OPT_REMOTE_PSWD=
1059+
WSREP_SST_OPT_REMOTE_USER="${WSREP_SST_OPT_REMOTE_AUTH%%:*}"
1060+
WSREP_SST_OPT_REMOTE_PSWD="${WSREP_SST_OPT_REMOTE_AUTH#*:}"
10711061
fi
10721062

1063+
readonly WSREP_SST_OPT_USER
1064+
readonly WSREP_SST_OPT_PSWD
1065+
readonly WSREP_SST_OPT_AUTH
1066+
readonly WSREP_SST_OPT_REMOTE_USER
1067+
readonly WSREP_SST_OPT_REMOTE_PSWD
10731068
readonly WSREP_SST_OPT_REMOTE_AUTH
10741069

10751070
if [ -n "$WSREP_SST_OPT_DATA" ]; then

scripts/wsrep_sst_mariabackup.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,15 +1100,13 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
11001100

11011101
wsrep_log_info "Using '$itmpdir' as mariadb-backup working directory"
11021102

1103-
usrst=0
11041103
if [ -n "$WSREP_SST_OPT_USER" ]; then
11051104
INNOEXTRA="$INNOEXTRA --user='$WSREP_SST_OPT_USER'"
1106-
usrst=1
11071105
fi
11081106

11091107
if [ -n "$WSREP_SST_OPT_PSWD" ]; then
11101108
export MYSQL_PWD="$WSREP_SST_OPT_PSWD"
1111-
elif [ $usrst -eq 1 ]; then
1109+
elif [ -n "$WSREP_SST_OPT_USER" ]; then
11121110
# Empty password, used for testing, debugging etc.
11131111
unset MYSQL_PWD
11141112
fi

scripts/wsrep_sst_mysqldump.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ then
4040
fi
4141

4242
# Check client version
43-
if ! $MYSQL_CLIENT --version | grep -q -E 'Distrib 10\.[1-9]'; then
43+
if ! $MYSQL_CLIENT --version | grep -q -E '(Distrib 10\.[1-9])|( from 1[1-9]\.)'; then
4444
$MYSQL_CLIENT --version >&2
4545
wsrep_log_error "this operation requires MySQL client version 10.1 or newer"
4646
exit $EINVAL
4747
fi
4848

4949
AUTH=""
50-
usrst=0
5150
if [ -n "$WSREP_SST_OPT_USER" ]; then
5251
AUTH="-u$WSREP_SST_OPT_USER"
53-
usrst=1
5452
fi
5553

5654
# Refs https://github.com/codership/mysql-wsrep/issues/141
@@ -64,7 +62,7 @@ fi
6462
# word, it is arguably more secure than passing password on the command line.
6563
if [ -n "$WSREP_SST_OPT_PSWD" ]; then
6664
export MYSQL_PWD="$WSREP_SST_OPT_PSWD"
67-
elif [ $usrst -eq 1 ]; then
65+
elif [ -n "$WSREP_SST_OPT_USER" ]; then
6866
# Empty password, used for testing, debugging etc.
6967
unset MYSQL_PWD
7068
fi

0 commit comments

Comments
 (0)