diff options
author | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2021-02-10 14:04:25 +0100 |
---|---|---|
committer | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2021-02-10 15:59:57 +0100 |
commit | 7a390916dcd3a792d6b08f5600b6fc302ee195b7 (patch) | |
tree | 2710da863abcecae9e7f4be1543ca47b51c29d7e | |
parent | afc5bac49d48b6fd13def25409642104b988de28 (diff) | |
download | mariadb-git-bb-10.2-MDEV-19950.tar.gz |
MDEV-19950: Galera test failure on galera_ssl_upgradebb-10.2-MDEV-19950
The test requires adaptation for MariaDB, which is done
in this patch. In addition, this patch includes a fix for
the SST script startup code that adds escaping for special
characters on the command line (in case they are contained
in the arguments to mysqld). The fix does not require
separate tests, as the required tests are already part
of the mtr suite for Galera.
-rw-r--r-- | mysql-test/suite/galera/disabled.def | 1 | ||||
-rw-r--r-- | mysql-test/suite/galera/include/galera_base_port.inc | 8 | ||||
-rw-r--r-- | mysql-test/suite/galera/r/galera_ssl_upgrade.result | 5 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_ssl_upgrade.cnf | 4 | ||||
-rw-r--r-- | mysql-test/suite/galera/t/galera_ssl_upgrade.test | 13 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 62 |
6 files changed, 79 insertions, 14 deletions
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 7fe03a94220..f05869a9e2f 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -22,7 +22,6 @@ galera_mdl_race : MDEV-21524: galera.galera_mdl_race MTR failed: query 'reap' su galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_partition : MDEV-21806: galera.galera_partition MTR failed: failed to recover from DONOR state galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim -galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key galera_var_node_address : MDEV-20485 Galera test failure galera_wan : MDEV-17259 Test failure on galera.galera_wan diff --git a/mysql-test/suite/galera/include/galera_base_port.inc b/mysql-test/suite/galera/include/galera_base_port.inc new file mode 100644 index 00000000000..caf986ee950 --- /dev/null +++ b/mysql-test/suite/galera/include/galera_base_port.inc @@ -0,0 +1,8 @@ +# +# Extract base_port from galera node. +# + +# Convert "... base_port = N; ..." to "N; ..." +--let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))` +# Convert "N; ..." to "N" +--let $_NODE_GALERAPORT = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)` diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index b24671d120d..5d2bfd299fd 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -4,12 +4,17 @@ VARIABLE_VALUE = 'Synced' SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; +connection node_2; +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_2; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 3fd1c650c05..2954ae0f4cb 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index eb5f79c12b4..4784fa784cd 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -6,15 +6,26 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_ssl_communication.inc SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +# Setup galera ports +--connection node_1 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + +--connection node_2 +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT + # 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate --connection node_1 --source include/shutdown_mysqld.inc ---let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem +--let $restart_noprint = 1 +--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem --source include/start_mysqld.inc --source include/wait_until_connected_again.inc diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index e12a26efbb6..f4092b9b8a7 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -707,8 +707,20 @@ static size_t estimate_cmd_len (bool* extra_args) char c; while ((c = *arg++) != 0) { - /* A whitespace or a single quote requires double quotation marks: */ - if (isspace(c) || c == '\'') + /* + Space, single quote, ampersand, and I/O redirection characters + require text to be enclosed in double quotes: + */ + if (isspace(c) || c == '\'' || c == '&' || c == '|' || +#ifdef __WIN__ + c == '>' || c == '<') +#else + /* + The semicolon is used to separate shell commands, so it must be + enclosed in double quotes as well: + */ + c == '>' || c == '<' || c == ';') +#endif { quotation= true; } @@ -731,10 +743,19 @@ static size_t estimate_cmd_len (bool* extra_args) while ((c = *arg++) != 0) { /* - A whitespace or a single quote requires double - quotation marks: + Space, single quote, ampersand, and I/O redirection characters + require text to be enclosed in double quotes: + */ + if (isspace(c) || c == '\'' || c == '&' || c == '|' || +#ifdef __WIN__ + c == '>' || c == '<') +#else + /* + The semicolon is used to separate shell commands, so it must be + enclosed in double quotes as well: */ - if (isspace(c) || c == '\'') + c == '>' || c == '<' || c == ';') +#endif { quotation= true; } @@ -815,8 +836,20 @@ static void copy_orig_argv (char* cmd_str) char c; while ((c = *arg_scan++) != 0) { - /* A whitespace or a single quote requires double quotation marks: */ - if (isspace(c) || c == '\'') + /* + Space, single quote, ampersand, and I/O redirection characters + require text to be enclosed in double quotes: + */ + if (isspace(c) || c == '\'' || c == '&' || c == '|' || +#ifdef __WIN__ + c == '>' || c == '<') +#else + /* + The semicolon is used to separate shell commands, so it must be + enclosed in double quotes as well: + */ + c == '>' || c == '<' || c == ';') +#endif { quotation= true; } @@ -890,10 +923,19 @@ static void copy_orig_argv (char* cmd_str) while ((c = *arg_scan++) != 0) { /* - A whitespace or a single quote requires double - quotation marks: + Space, single quote, ampersand, and I/O redirection characters + require text to be enclosed in double quotes: + */ + if (isspace(c) || c == '\'' || c == '&' || c == '|' || +#ifdef __WIN__ + c == '>' || c == '<') +#else + /* + The semicolon is used to separate shell commands, so it must be + enclosed in double quotes as well: */ - if (isspace(c) || c == '\'') + c == '>' || c == '<' || c == ';') +#endif { quotation= true; } |