@@ -99,7 +99,6 @@ WSREP_SST_OPT_ADDR=""
99
99
WSREP_SST_OPT_ADDR_PORT=" "
100
100
WSREP_SST_OPT_HOST=" "
101
101
WSREP_SST_OPT_HOST_UNESCAPED=" "
102
- WSREP_SST_OPT_HOST_ESCAPED=" "
103
102
INNODB_DATA_HOME_DIR=$( trim_dir " ${INNODB_DATA_HOME_DIR:- } " )
104
103
INNODB_LOG_GROUP_HOME=$( trim_dir " ${INNODB_LOG_GROUP_HOME:- } " )
105
104
INNODB_UNDO_DIR=$( trim_dir " ${INNODB_UNDO_DIR:- } " )
@@ -122,60 +121,55 @@ case "$1" in
122
121
# without square brackets:
123
122
readonly WSREP_SST_OPT_HOST_UNESCAPED=" ${addr_no_bracket%% \] * } "
124
123
# Square brackets are needed in most cases:
125
- readonly WSREP_SST_OPT_HOST=" [${WSREP_SST_OPT_HOST_UNESCAPED} ]"
126
- readonly WSREP_SST_OPT_HOST_ESCAPED=" \\ [${WSREP_SST_OPT_HOST_UNESCAPED} \\ ]"
124
+ readonly WSREP_SST_OPT_HOST=" [$WSREP_SST_OPT_HOST_UNESCAPED ]"
127
125
# Mark this address as IPv6:
128
126
readonly WSREP_SST_OPT_HOST_IPv6=1
127
+ # Let's remove the leading part that contains the host address:
128
+ remain=" ${WSREP_SST_OPT_ADDR#* \] } "
129
129
;;
130
130
* )
131
131
readonly WSREP_SST_OPT_HOST=" ${WSREP_SST_OPT_ADDR%% [:/]* } "
132
132
readonly WSREP_SST_OPT_HOST_UNESCAPED=" $WSREP_SST_OPT_HOST "
133
- readonly WSREP_SST_OPT_HOST_ESCAPED=" $WSREP_SST_OPT_HOST "
134
133
readonly WSREP_SST_OPT_HOST_IPv6=0
134
+ # Let's remove the leading part that contains the host address:
135
+ remain=" ${WSREP_SST_OPT_ADDR#* [:/]} "
135
136
;;
136
137
esac
137
- # Let's remove the leading part that contains the host address :
138
- remain= " ${ WSREP_SST_OPT_ADDR# $WSREP_SST_OPT_HOST_ESCAPED } "
138
+ # If there is nothing but the address, then the remainder is empty :
139
+ [ " $ remain" = " $ WSREP_SST_OPT_ADDR" ] && remain= " "
139
140
# Let's remove the ":" character that separates the port number
140
141
# from the hostname:
141
142
remain=" ${remain#: } "
142
143
# Extract the port number from the address - all characters
143
144
# up to "/" (if present):
144
145
WSREP_SST_OPT_ADDR_PORT=" ${remain%%/* } "
145
146
# If the "/" character is present, then the path is not empty:
146
- if [ " ${remain #*/ } " != " $remain " ]; then
147
+ if [ " $WSREP_SST_OPT_ADDR_PORT " != " $remain " ]; then
147
148
# This operation removes everything up to the "/" character,
148
149
# effectively removing the port number from the string:
149
150
readonly WSREP_SST_OPT_PATH=" ${remain#*/ } "
150
151
else
151
152
readonly WSREP_SST_OPT_PATH=" "
152
153
fi
153
- # The rest of the string is the same as the path (for now):
154
- remain=" $WSREP_SST_OPT_PATH "
155
- # If there is one more "/" in the string, then everything before
156
- # it will be the module name, otherwise the module name is empty:
157
- if [ " ${remain%%/* } " != " $remain " ]; then
158
- # This operation removes the tail after the very first
159
- # occurrence of the "/" character (inclusively):
160
- readonly WSREP_SST_OPT_MODULE=" ${remain%%/* } "
161
- else
162
- readonly WSREP_SST_OPT_MODULE=" "
163
- fi
164
154
# Remove the module name part from the string, which ends with "/":
165
155
remain=" ${WSREP_SST_OPT_PATH#*/ } "
166
- # If the rest of the string does not match the original, then there
167
- # was something else besides the module name:
156
+ # This operation removes the tail after the very first occurrence
157
+ # of the "/" character, inclusively:
158
+ readonly WSREP_SST_OPT_MODULE=" ${WSREP_SST_OPT_PATH%%/* } "
159
+ # If there is one more "/" in the string, then everything before
160
+ # it will be the LSN, otherwise the LSN is empty:
168
161
if [ " $remain " != " $WSREP_SST_OPT_PATH " ]; then
169
162
# Extract the part that matches the LSN by removing all
170
163
# characters starting from the very first "/":
171
164
readonly WSREP_SST_OPT_LSN=" ${remain%%/* } "
172
165
# Exctract everything after the first occurrence of
173
166
# the "/" character in the string:
167
+ source=" $remain "
174
168
remain=" ${remain#*/ } "
175
169
# If the remainder does not match the original string,
176
170
# then there is something else (the version number in
177
171
# our case):
178
- if [ " $remain " != " $WSREP_SST_OPT_LSN " ]; then
172
+ if [ " $remain " != " $source " ]; then
179
173
# Let's extract the version number by removing the tail
180
174
# after the very first occurence of the "/" character
181
175
# (inclusively):
@@ -238,14 +232,12 @@ case "$1" in
238
232
readonly WSREP_SST_OPT_HOST_UNESCAPED=" ${addr_no_bracket%% \] * } "
239
233
# Square brackets are needed in most cases:
240
234
readonly WSREP_SST_OPT_HOST=" [${WSREP_SST_OPT_HOST_UNESCAPED} ]"
241
- readonly WSREP_SST_OPT_HOST_ESCAPED=" \\ [${WSREP_SST_OPT_HOST_UNESCAPED} \\ ]"
242
235
# Mark this address as IPv6:
243
236
readonly WSREP_SST_OPT_HOST_IPv6=1
244
237
;;
245
238
* )
246
239
readonly WSREP_SST_OPT_HOST=" $2 "
247
240
readonly WSREP_SST_OPT_HOST_UNESCAPED=" $2 "
248
- readonly WSREP_SST_OPT_HOST_ESCAPED=" $2 "
249
241
readonly WSREP_SST_OPT_HOST_IPv6=0
250
242
;;
251
243
esac
@@ -475,25 +467,25 @@ case "$1" in
475
467
;;
476
468
' --innodb-force-recovery' )
477
469
if [ -n " $value " -a " $value " != " 0" ]; then
478
- INNODB_FORCE_RECOVERY=" $value "
470
+ INNODB_FORCE_RECOVERY=$( trim_string " $value " )
479
471
fi
480
472
skip_mysqld_arg=1
481
473
;;
482
474
' --log-bin' )
483
475
if [ -z " $WSREP_SST_OPT_BINLOG " ]; then
484
- MYSQLD_OPT_LOG_BIN=" $value "
476
+ MYSQLD_OPT_LOG_BIN=$( trim_string " $value " )
485
477
fi
486
478
skip_mysqld_arg=1
487
479
;;
488
480
' --log-bin-index' )
489
481
if [ -z " $WSREP_SST_OPT_BINLOG_INDEX " ]; then
490
- MYSQLD_OPT_LOG_BIN_INDEX=" $value "
482
+ MYSQLD_OPT_LOG_BIN_INDEX=$( trim_string " $value " )
491
483
fi
492
484
skip_mysqld_arg=1
493
485
;;
494
486
' --log-basename' )
495
487
if [ -z " $WSREP_SST_OPT_LOG_BASENAME " ]; then
496
- MYSQLD_OPT_LOG_BASENAME=" $value "
488
+ MYSQLD_OPT_LOG_BASENAME=$( trim_string " $value " )
497
489
fi
498
490
skip_mysqld_arg=1
499
491
;;
@@ -678,27 +670,18 @@ if [ -n "$WSREP_SST_OPT_ADDR_PORT" ]; then
678
670
# the corresponding variable:
679
671
readonly WSREP_SST_OPT_PORT=" $WSREP_SST_OPT_ADDR_PORT "
680
672
fi
681
- elif [ -n " $WSREP_SST_OPT_ADDR " ] ; then
673
+ else
682
674
# If the port is missing, take the default port:
683
675
if [ -z " $WSREP_SST_OPT_PORT " ]; then
684
676
readonly WSREP_SST_OPT_PORT=4444
685
677
fi
686
678
WSREP_SST_OPT_ADDR_PORT=" $WSREP_SST_OPT_PORT "
687
- # Let's remove the leading part that contains the host address:
688
- remain=" ${WSREP_SST_OPT_ADDR# $WSREP_SST_OPT_HOST_ESCAPED } "
689
- # Let's remove the ":" character that separates the port number
690
- # from the hostname:
691
- remain=" ${remain#: } "
692
- # Let's remove all characters upto first "/" character that
693
- # separates the hostname with port number from the path:
694
- remain=" ${remain#/ } "
695
- # Let's construct a new value for the address with the port:
696
- WSREP_SST_OPT_ADDR=" $WSREP_SST_OPT_HOST :$WSREP_SST_OPT_PORT "
697
- if [ -n " $remain " ]; then
698
- WSREP_SST_OPT_ADDR=" $WSREP_SST_OPT_ADDR /$remain "
699
- fi
700
679
fi
701
680
681
+ # Let's construct a new value for the address with the port:
682
+ sst_path=" ${WSREP_SST_OPT_PATH: +/ } $WSREP_SST_OPT_PATH "
683
+ WSREP_SST_OPT_ADDR=" $WSREP_SST_OPT_HOST :$WSREP_SST_OPT_PORT$sst_path "
684
+
702
685
readonly WSREP_SST_OPT_ADDR
703
686
readonly WSREP_SST_OPT_ADDR_PORT
704
687
@@ -809,8 +792,11 @@ parse_cnf()
809
792
local group=" ${groups%% \| * } "
810
793
# Remove the remainder (the group name) from the rest
811
794
# of the groups list (as if it were a prefix):
812
- groups=" ${groups# $group } "
813
- groups=" ${groups# \| } "
795
+ if [ " $group " != " $groups " ]; then
796
+ groups=" ${groups#* \| } "
797
+ else
798
+ groups=" "
799
+ fi
814
800
# If the group name is the same as the "mysqld" without "--" prefix,
815
801
# then try to use it together with the group suffix:
816
802
if [ " $group " = ' mysqld' -a -n " $WSREP_SST_OPT_SUFFIX_VALUE " ]; then
@@ -835,9 +821,11 @@ parse_cnf()
835
821
done
836
822
837
823
# Use default if we haven't found a value:
838
- if [ -z " $reval " ]; then
839
- [ -n " ${3:- } " ] && reval=" $3 "
840
- fi
824
+ [ -z " $reval " ] && reval=" ${3:- } "
825
+
826
+ # Truncate spaces:
827
+ [ -n " $reval " ] && reval=$( trim_string " $reval " )
828
+
841
829
if [ -n " $BASH_VERSION " ]; then
842
830
printf ' %s' " $reval "
843
831
else
@@ -868,8 +856,11 @@ in_config()
868
856
local group=" ${groups%% \| * } "
869
857
# Remove the remainder (the group name) from the rest
870
858
# of the groups list (as if it were a prefix):
871
- groups=" ${groups# $group } "
872
- groups=" ${groups# \| } "
859
+ if [ " $group " != " $groups " ]; then
860
+ groups=" ${groups#* \| } "
861
+ else
862
+ groups=" "
863
+ fi
873
864
# If the group name is the same as the "mysqld" without "--" prefix,
874
865
# then try to use it together with the group suffix:
875
866
if [ " $group " = ' mysqld' -a -n " $WSREP_SST_OPT_SUFFIX_VALUE " ]; then
@@ -1455,13 +1446,9 @@ check_server_ssl_config()
1455
1446
fi
1456
1447
fi
1457
1448
if [ -n " $tcert " ]; then
1458
- tcert=$( trim_string " $tcert " )
1459
1449
if [ " ${tcert%/ } " != " $tcert " -o -d " $tcert " ]; then
1460
1450
tcap=" $tcert "
1461
1451
tcert=" "
1462
1452
fi
1463
1453
fi
1464
- if [ -n " $tcap " ]; then
1465
- tcap=$( trim_string " $tcap " )
1466
- fi
1467
1454
}
0 commit comments