Skip to content

Commit 8f30973

Browse files
committed
MDEV-29814: galera_var_notify_ssl_ipv6 causes testing system to hang
This commit fixes the test system hanging due to the galera_var_notify_ssl_ipv6 test and also brings the wsrep_notify[_ssl].sh files in line with each other between the user template and the mtr suite. Quotes are also added here to avoid problems if the user specifies the value of one of the variables at the beginning of the file containing shell-specific characters, for example, if the password or username specified in the PSWD and USER variables will contain the "$" character. Also fixed an issue with automatic --ssl-verify-server-cert option substitution when the corresponding value is set by the user to "1" or "on". Also fixed some tests here to avoid joining one of the nodes to another cluster when the nodes are restarted from the mtr side, which can lead to random failures when testing with buildbot.
1 parent 782b2a7 commit 8f30973

File tree

7 files changed

+161
-88
lines changed

7 files changed

+161
-88
lines changed

mysql-test/std_data/wsrep_notify.sh

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
#
77
# Edit parameters below to specify the address and login to server:
88
#
9-
USER=root
10-
PSWD=
9+
USER='root'
10+
PSWD=''
1111
#
1212
# If these parameters are not set, then the values
1313
# passed by the server are taken:
1414
#
15-
HOST=127.0.0.1
15+
HOST="127.0.0.1"
1616
PORT=$NODE_MYPORT_1
1717
#
1818
# Edit parameters below to specify SSL parameters:
1919
#
20-
ssl_key=
21-
ssl_cert=
22-
ssl_ca=
23-
ssl_capath=
24-
ssl_cipher=
25-
ssl_crl=
26-
ssl_crlpath=
20+
ssl_cert=""
21+
ssl_key=""
22+
ssl_ca=""
23+
ssl_capath=""
24+
ssl_cipher=""
25+
ssl_crl=""
26+
ssl_crlpath=""
2727
ssl_verify_server_cert=0
2828
#
2929
# Client executable path:
3030
#
3131
CLIENT="$EXE_MYSQL"
32-
32+
#
33+
# Name of schema and tables:
34+
#
3335
SCHEMA="mtr_wsrep_notify"
3436
MEMB_TABLE="$SCHEMA.membership"
3537
STATUS_TABLE="$SCHEMA.status"
@@ -65,9 +67,9 @@ configuration_change()
6567
do
6668
echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, "
6769
# Don't forget to properly quote string values
68-
echo "'$NODE'" | sed s/\\//\',\'/g
70+
echo "'$NODE'" | sed s/\\//\',\'/g
6971
echo ");"
70-
idx=$(( $idx + 1 ))
72+
idx=$(( $idx+1 ))
7173
done
7274

7375
echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
@@ -102,34 +104,35 @@ trim_string()
102104
fi
103105
}
104106

105-
COM=status_update # not a configuration change by default
107+
COM='status_update' # not a configuration change by default
106108

107109
STATUS=""
108110
CLUSTER_UUID=""
109-
PRIMARY="0"
111+
PRIMARY=0
110112
INDEX=""
111113
MEMBERS=""
112114

113115
while [ $# -gt 0 ]; do
114116
case $1 in
115-
--status)
117+
'--status')
116118
STATUS=$(trim_string "$2")
117119
shift
118120
;;
119-
--uuid)
121+
'--uuid')
120122
CLUSTER_UUID=$(trim_string "$2")
121123
shift
122124
;;
123-
--primary)
124-
[ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0"
125-
COM=configuration_change
125+
'--primary')
126+
arg=$(trim_string "$2")
127+
[ "$arg" = 'yes' ] && PRIMARY=1 || PRIMARY=0
128+
COM='configuration_change'
126129
shift
127130
;;
128-
--index)
131+
'--index')
129132
INDEX=$(trim_string "$2")
130133
shift
131134
;;
132-
--members)
135+
'--members')
133136
MEMBERS=$(trim_string "$2")
134137
shift
135138
;;
@@ -168,9 +171,7 @@ ssl_verify_server_cert=$(trim_string "$ssl_verify_server_cert");
168171

169172
SSL_PARAM=""
170173

171-
if [ -n "$ssl_key" -o -n "$ssl_cert" -o \
172-
-n "$ssl_ca" -o -n "$ssl_capath" -o \
173-
-n "$ssl_cipher" ]
174+
if [ -n "$ssl_key$ssl_cert$ssl_ca$ssl_capath$ssl_cipher$ssl_crl$ssl_crlpath" ]
174175
then
175176
SSL_PARAM=' --ssl'
176177
[ -n "$ssl_key" ] && SSL_PARAM="$SSL_PARAM --ssl-key='$ssl_key'"
@@ -181,8 +182,10 @@ then
181182
[ -n "$ssl_crl" ] && SSL_PARAM="$SSL_PARAM --ssl-crl='$ssl_crl'"
182183
[ -n "$ssl_crlpath" ] && SSL_PARAM="$SSL_PARAM --ssl-crlpath='$ssl_crlpath'"
183184
if [ -n "$ssl_verify_server_cert" ]; then
184-
if [ $ssl_verify_server_cert -ne 0 ]; then
185-
SSL_PARAM+=' --ssl-verify-server-cert'
185+
if [ "$ssl_verify_server_cert" != "0" -o \
186+
"$ssl_verify_server_cert" = "on" ]
187+
then
188+
SSL_PARAM="$SSL_PARAM --ssl-verify-server-cert"
186189
fi
187190
fi
188191
fi

mysql-test/std_data/wsrep_notify_ssl.sh

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
#
77
# Edit parameters below to specify the address and login to server:
88
#
9-
USER=root
10-
PSWD=
9+
USER='root'
10+
PSWD=''
1111
#
1212
# If these parameters are not set, then the values
1313
# passed by the server are taken:
1414
#
15-
HOST=127.0.0.1
15+
HOST="127.0.0.1"
1616
PORT=$NODE_MYPORT_1
1717
#
1818
# Edit parameters below to specify SSL parameters:
1919
#
2020
ssl_cert="$MYSQL_TEST_DIR/std_data/client-cert.pem"
2121
ssl_key="$MYSQL_TEST_DIR/std_data/client-key.pem"
2222
ssl_ca="$MYSQL_TEST_DIR/std_data/cacert.pem"
23-
ssl_capath=
24-
ssl_cipher=
25-
ssl_crl=
26-
ssl_crlpath=
23+
ssl_capath=""
24+
ssl_cipher=""
25+
ssl_crl=""
26+
ssl_crlpath=""
2727
ssl_verify_server_cert=0
2828
#
2929
# Client executable path:
3030
#
3131
CLIENT="$EXE_MYSQL"
32-
32+
#
33+
# Name of schema and tables:
34+
#
3335
SCHEMA="mtr_wsrep_notify"
3436
MEMB_TABLE="$SCHEMA.membership"
3537
STATUS_TABLE="$SCHEMA.status"
@@ -65,9 +67,9 @@ configuration_change()
6567
do
6668
echo "INSERT INTO $MEMB_TABLE VALUES ( $idx, "
6769
# Don't forget to properly quote string values
68-
echo "'$NODE'" | sed s/\\//\',\'/g
70+
echo "'$NODE'" | sed s/\\//\',\'/g
6971
echo ");"
70-
idx=$(( $idx + 1 ))
72+
idx=$(( $idx+1 ))
7173
done
7274

7375
echo "INSERT INTO $STATUS_TABLE VALUES($idx, $INDEX, '$STATUS', '$CLUSTER_UUID', $PRIMARY);"
@@ -102,34 +104,35 @@ trim_string()
102104
fi
103105
}
104106

105-
COM=status_update # not a configuration change by default
107+
COM='status_update' # not a configuration change by default
106108

107109
STATUS=""
108110
CLUSTER_UUID=""
109-
PRIMARY="0"
111+
PRIMARY=0
110112
INDEX=""
111113
MEMBERS=""
112114

113115
while [ $# -gt 0 ]; do
114116
case $1 in
115-
--status)
117+
'--status')
116118
STATUS=$(trim_string "$2")
117119
shift
118120
;;
119-
--uuid)
121+
'--uuid')
120122
CLUSTER_UUID=$(trim_string "$2")
121123
shift
122124
;;
123-
--primary)
124-
[ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0"
125-
COM=configuration_change
125+
'--primary')
126+
arg=$(trim_string "$2")
127+
[ "$arg" = 'yes' ] && PRIMARY=1 || PRIMARY=0
128+
COM='configuration_change'
126129
shift
127130
;;
128-
--index)
131+
'--index')
129132
INDEX=$(trim_string "$2")
130133
shift
131134
;;
132-
--members)
135+
'--members')
133136
MEMBERS=$(trim_string "$2")
134137
shift
135138
;;
@@ -168,9 +171,7 @@ ssl_verify_server_cert=$(trim_string "$ssl_verify_server_cert");
168171

169172
SSL_PARAM=""
170173

171-
if [ -n "$ssl_key" -o -n "$ssl_cert" -o \
172-
-n "$ssl_ca" -o -n "$ssl_capath" -o \
173-
-n "$ssl_cipher" ]
174+
if [ -n "$ssl_key$ssl_cert$ssl_ca$ssl_capath$ssl_cipher$ssl_crl$ssl_crlpath" ]
174175
then
175176
SSL_PARAM=' --ssl'
176177
[ -n "$ssl_key" ] && SSL_PARAM="$SSL_PARAM --ssl-key='$ssl_key'"
@@ -181,8 +182,10 @@ then
181182
[ -n "$ssl_crl" ] && SSL_PARAM="$SSL_PARAM --ssl-crl='$ssl_crl'"
182183
[ -n "$ssl_crlpath" ] && SSL_PARAM="$SSL_PARAM --ssl-crlpath='$ssl_crlpath'"
183184
if [ -n "$ssl_verify_server_cert" ]; then
184-
if [ $ssl_verify_server_cert -ne 0 ]; then
185-
SSL_PARAM+=' --ssl-verify-server-cert'
185+
if [ "$ssl_verify_server_cert" != "0" -o \
186+
"$ssl_verify_server_cert" = "on" ]
187+
then
188+
SSL_PARAM="$SSL_PARAM --ssl-verify-server-cert"
186189
fi
187190
fi
188191
fi

mysql-test/suite/galera/r/galera_wsrep_new_cluster.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
connection node_1;
2+
connection node_2;
3+
connection node_2;
4+
Shutting down server ...
5+
connection node_1;
6+
connection node_2;
7+
Cleaning grastate.dat file ...
8+
Starting server ...
9+
connection node_1;
210
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
311
VARIABLE_VALUE
412
Primary
@@ -36,3 +44,7 @@ VARIABLE_VALUE
3644
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
3745
VARIABLE_VALUE
3846
Synced
47+
Shutting down server ...
48+
Cleaning var directory ...
49+
Starting server ...
50+
connection node_1;

mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
77
bind-address=::
88

99
[mysqld.1]
10-
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;gcache.size=1;pc.ignore_sb=true'
10+
wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M'
1111
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
12-
wsrep_node_address=::1
12+
wsrep_node_address=[::1]:@mysqld.1.#galera_port
1313
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
1414

1515
[mysqld.2]
1616
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
17-
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;gcache.size=1;pc.ignore_sb=true'
18-
wsrep_node_address=::1
17+
wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M'
1918
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
19+
wsrep_node_address=[::1]:@mysqld.2.#galera_port
2020
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'

mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt

Lines changed: 0 additions & 1 deletion
This file was deleted.

mysql-test/suite/galera/t/galera_wsrep_new_cluster.test

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@
77
--source include/galera_cluster.inc
88
--source include/have_innodb.inc
99

10+
# Save original auto_increment_offset values.
11+
--let $node_1=node_1
12+
--let $node_2=node_2
13+
--source include/auto_increment_offset_save.inc
14+
15+
--connection node_2
16+
--echo Shutting down server ...
17+
--source include/shutdown_mysqld.inc
18+
19+
--connection node_1
20+
21+
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
22+
--source include/wait_condition.inc
23+
24+
--connection node_2
25+
26+
#
27+
# Delete grastate.dat with safe_to_bootstrap: 0
28+
#
29+
--echo Cleaning grastate.dat file ...
30+
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
31+
32+
--echo Starting server ...
33+
--let $restart_noprint=2
34+
--let $start_mysqld_params="--wsrep-new-cluster"
35+
--source include/start_mysqld.inc
36+
--source include/wait_until_ready.inc
37+
1038
--connection node_1
1139

1240
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@@ -38,3 +66,29 @@ SELECT (VARIABLE_VALUE = 0 OR VARIABLE_VALUE = 1 ) FROM INFORMATION_SCHEMA.GLOBA
3866
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
3967
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
4068
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
69+
70+
--echo Shutting down server ...
71+
--source include/shutdown_mysqld.inc
72+
73+
#
74+
# Force SST
75+
#
76+
--echo Cleaning var directory ...
77+
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
78+
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr
79+
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema
80+
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test
81+
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql
82+
--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data
83+
84+
--echo Starting server ...
85+
--let $start_mysqld_params=
86+
--source include/start_mysqld.inc
87+
--source include/wait_until_ready.inc
88+
89+
--connection node_1
90+
91+
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
92+
--source include/wait_condition.inc
93+
94+
--source include/auto_increment_offset_restore.inc

0 commit comments

Comments
 (0)