From dfc9bff5a9f402ebe9beff2912aab2f53b0c27ad Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 1 Feb 2019 17:45:15 +0100 Subject: [PATCH] MDEV-18379: IPv6 compatibility changes/Unification of check for IPv6 This patch contains the port of the MDEV-18379 patch for 10.2 branch, but also includes a number of changes made within MDEV-17835, which are necessary for the normal operation of tests that use IPv6: 1) Currently, the three-node mtr suite for Galera (galera_3nodes) uses a separate IPv6 availability check using the "have_ipv6.inc" file. This check duplicates a more accurate check at suite.pm level, which can be used by including the file "check_ipv6.inc". This patch removes this discrepancy between suites. 2) Fixed numerous bugs in the SST scripts and in the mtr test files (galera_3nodes mtr suite) that prevented the use of Galera with IPv6 addresses. 3) Fixed flaws in the galera_3nodes mtr suite control scripts, because of which they could not work with mariabackup. 4) Fixed flaws in the rsync and mysqldump tests (for galera_3nodes mtr tests suite). These tests were not performed successfully without these fixes. 5) GAL-501 test in the galera_3nodes suite does not contain the option "--bind-address=::" that is needed for the test to work correctly with IPv6 (at least on some systems), since without it the server will not wait for connections on the IPv6 interface. https://jira.mariadb.org/browse/MDEV-18379 and partially https://jira.mariadb.org/browse/MDEV-17835 --- mysql-test/suite/galera_3nodes/disabled.def | 2 -- mysql-test/suite/galera_3nodes/r/GAL-501.result | 3 +++ .../r/galera_innobackupex_backup.result | 6 ++++++ .../galera_3nodes/r/galera_ipv6_mariabackup.result | 4 ++++ .../galera_3nodes/r/galera_ipv6_mysqldump.result | 12 ++++++++++-- .../suite/galera_3nodes/r/galera_ipv6_rsync.result | 3 +++ .../galera_3nodes/r/galera_ipv6_xtrabackup-v2.result | 4 ++++ mysql-test/suite/galera_3nodes/suite.pm | 6 +++--- .../galera_3nodes/t/galera_ipv6_mariabackup.test | 2 +- .../suite/galera_3nodes/t/galera_ipv6_mysqldump.opt | 1 + .../suite/galera_3nodes/t/galera_ipv6_rsync.opt | 1 + .../galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt | 2 +- scripts/wsrep_sst_mariabackup.sh | 6 +++--- scripts/wsrep_sst_rsync.sh | 4 ++-- 14 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index e640baebf7d..1683485981b 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -1,4 +1,2 @@ galera_slave_options_do :MDEV-8798 galera_slave_options_ignore : MDEV-8798 -galera_innobackupex_backup : xtrabackup is deprecated -galera_ipv6_xtrabackup-v2 : xtrabackup is deprecated diff --git a/mysql-test/suite/galera_3nodes/r/GAL-501.result b/mysql-test/suite/galera_3nodes/r/GAL-501.result index a2bf5f4d98c..bcf74142144 100644 --- a/mysql-test/suite/galera_3nodes/r/GAL-501.result +++ b/mysql-test/suite/galera_3nodes/r/GAL-501.result @@ -4,9 +4,12 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 diff --git a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result index 85000db8e77..6ed7587303d 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_innobackupex_backup.result @@ -1,9 +1,15 @@ +connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE TABLE t1 (f1 INTEGER); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +connection node_2; SELECT COUNT(*) = 10 FROM t1; COUNT(*) = 10 1 Killing server ... +connection node_1; INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); SELECT COUNT(*) = 20 FROM t1; COUNT(*) = 20 diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result index 53e35939a79..5665ed5f46a 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup.result @@ -4,14 +4,18 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 DROP TABLE t1; +connection node_1; include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result index 1d9ae940cfb..3564dc8c5a1 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mysqldump.result @@ -1,13 +1,20 @@ call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to'"); call mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos"); +connection node_1; +connection node_2; +connection node_3; +connection node_1; CREATE USER 'sst'; GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; +connection node_2; SET GLOBAL wsrep_sst_method = 'mysqldump'; Shutting down server ... +connection node_1; Cleaning var directory ... CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; Starting server ... SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 @@ -16,14 +23,15 @@ DROP TABLE t1; SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; VARIABLE_VALUE LIKE '%[::1]%' 1 +connection node_1; CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); DROP USER sst; +connection node_2; CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query"); CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found"); -CALL mtr.add_suppression("InnoDB: New log files created"); -CALL mtr.add_suppression("InnoDB: Creating foreign key constraint system tables"); CALL mtr.add_suppression("Can't open and lock time zone table"); CALL mtr.add_suppression("Can't open and lock privilege tables"); CALL mtr.add_suppression("Info table is not ready to be used"); CALL mtr.add_suppression("Native table .* has the wrong structure"); +connection node_2; CALL mtr.add_suppression("Unsupported protocol downgrade: incremental data collection disabled. Expect abort"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result index a2bf5f4d98c..bcf74142144 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync.result @@ -4,9 +4,12 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result index 53e35939a79..5665ed5f46a 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_xtrabackup-v2.result @@ -4,14 +4,18 @@ VARIABLE_VALUE LIKE '%[::1]%' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 DROP TABLE t1; +connection node_1; include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 66502c00c6b..a7c1bf79c06 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -81,11 +81,11 @@ sub skip_combinations { my %skip = (); $skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin' unless $ENV{FILE_KEY_MANAGEMENT_SO}; - $skip{'include/have_mariabackup.inc'} = 'Need mariabackup' + $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need mariabackup' unless which(mariabackup); - $skip{'include/have_mariabackup.inc'} = 'Need ss' + $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need ss' unless which(ss); - $skip{'include/have_mariabackup.inc'} = 'Need socat or nc' + $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need socat or nc' unless $ENV{MTR_GALERA_TFMT}; %skip; } diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test index 8cbd8cf2454..84c33251c98 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test @@ -1,6 +1,6 @@ --source include/galera_cluster.inc --source include/check_ipv6.inc ---source include/have_mariabackup.inc +--source suite/galera/include/have_mariabackup.inc # Confirm that initial handshake happened over ipv6 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt index c2bb4d156af..c195dd0f35b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_xtrabackup-v2.opt @@ -1 +1 @@ ---bind-address=:: +--bind-address=:: --skip-innodb-safe-truncate diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 2eedbb4b189..039a350b18a 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -522,7 +522,7 @@ kill_xtrabackup() setup_ports() { if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then - if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then + if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then remain=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\][:/]' '{ print $2 }') REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\]:' '{ print $1 }')"]" SST_PORT=$(echo $remain | awk -F '[:/]' '{ print $1 }') @@ -535,7 +535,7 @@ setup_ports() sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }') fi else - if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then + if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $2 }') else SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }') @@ -957,7 +957,7 @@ then if [ -z "${SST_PORT}" ] then SST_PORT=4444 - if [[ ${ADDR:0:1} == '[' ]];then + if [ "${ADDR#\[}" != "$ADDR" ]; then ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $1 }')]:${SST_PORT}" else ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}" diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 72ad080591c..0563343fbea 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -88,7 +88,7 @@ check_pid_and_port() local is_listening_all="$(echo $port_info | \ grep "*:$rsync_port" 2>/dev/null)" local is_listening_addr="$(echo $port_info | \ - grep "$rsync_addr:$rsync_port" 2>/dev/null)" + grep -F "$rsync_addr:$rsync_port" 2>/dev/null)" if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then if [ -z "$is_rsync" ]; then @@ -118,7 +118,7 @@ is_local_ip() address="$address " fi - $get_addr_bin | grep "$address" > /dev/null + $get_addr_bin | grep -F "$address" > /dev/null } STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf"