diff options
author | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2020-10-06 14:57:28 +0200 |
---|---|---|
committer | Julius Goryavsky <julius.goryavsky@mariadb.com> | 2020-10-07 14:54:45 +0200 |
commit | 02564c1d55935575463c7b3290c37dfaab4a3036 (patch) | |
tree | e4d2fdcc2e1f22910e697739d491b6047da6c793 | |
parent | 7d4f44bb3747871c437e8e2ba8eb885e14bdd50c (diff) | |
download | mariadb-git-bb-10.3-MDEV-21770-v2.tar.gz |
MDEV-21770v2: Fixed address parsing issues and added explicit '-6' option for debian netcatbb-10.3-MDEV-21770-v2
-rw-r--r-- | mysql-test/suite/galera_3nodes/disabled.def | 2 | ||||
-rw-r--r-- | scripts/wsrep_sst_common.sh | 16 | ||||
-rw-r--r-- | scripts/wsrep_sst_mariabackup.sh | 51 |
3 files changed, 35 insertions, 34 deletions
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index ff7262947a0..4a8e2ff934b 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -11,8 +11,6 @@ ############################################################################## galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster -galera_ipv6_mariabackup : MDEV-21770 galera_3nodes.galera_ipv6_mariabackup fails -galera_ipv6_mariabackup_section : MDEV-21770 galera_3nodes.galera_ipv6_mariabackup fails galera_ipv6_mysqldump : MDEV-23576 galera_3nodes.galera_ipv6_mysqldump MTR failed: WSREP_SST: [ERROR] rsync daemon port '16008' has been taken galera_ipv6_rsync : MDEV-23581 galera_3nodes.galera_ipv6_rsync MTR failed: WSREP_SST: [ERROR] rsync daemon port '16008' has been taken galera_ipv6_rsync_section : MDEV-23580 galera_3nodes.galera_ipv6_rsync_section MTR failed: WSREP_SST: [ERROR] rsync daemon port '16008' has been taken diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 16607470f2c..37ff494efda 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -49,19 +49,29 @@ case "$1" in readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*} readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]" readonly WSREP_SST_OPT_HOST_ESCAPED="\\[${WSREP_SST_OPT_HOST_UNESCAPED}\\]" + readonly WSREP_SST_OPT_HOST_IPv6=1 ;; *) readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} readonly WSREP_SST_OPT_HOST_UNESCAPED=$WSREP_SST_OPT_HOST readonly WSREP_SST_OPT_HOST_ESCAPED=$WSREP_SST_OPT_HOST + readonly WSREP_SST_OPT_HOST_IPv6=0 ;; esac remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST_ESCAPED}} remain=${remain#:} readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*} - remain=${remain#*/} - readonly WSREP_SST_OPT_MODULE=${remain%%/*} - readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/} + if [ "${remain#*/}" != "${remain}" ]; then + readonly WSREP_SST_OPT_PATH=${remain#*/} + else + readonly WSREP_SST_OPT_PATH="" + fi + remain=${WSREP_SST_OPT_PATH} + if [ "${remain%%/*}" != "${remain}" ]; then + readonly WSREP_SST_OPT_MODULE=${remain%%/*} + else + readonly WSREP_SST_OPT_MODULE="" + fi remain=${WSREP_SST_OPT_PATH#*/} if [ "$remain" != "${WSREP_SST_OPT_PATH}" ]; then readonly WSREP_SST_OPT_LSN=${remain%%/*} diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 7dce6a84751..d9c24b891c5 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -188,16 +188,23 @@ get_transfer() if nc -h 2>&1 | grep -q ncat;then # Ncat tcmd="nc -l ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then + elif nc -h 2>&1 | grep -qw -- '-d\>';then # Debian netcat - tcmd="nc -dl ${TSST_PORT}" + if [ $WSREP_SST_OPT_HOST_IPv6 -eq 1 ];then + # When host is not explicitly specified (when only the port + # is specified) netcat can only bind to an IPv4 address if + # the "-6" option is not explicitly specified: + tcmd="nc -dl -6 ${TSST_PORT}" + else + tcmd="nc -dl ${TSST_PORT}" + fi else # traditional netcat tcmd="nc -l -p ${TSST_PORT}" fi else # Check to see if netcat supports the '-N' flag. - # -N Shutdown the network socket after EOF on stdin + # -N Shutdown the network socket after EOF on stdin # If it supports the '-N' flag, then we need to use the '-N' # flag, otherwise the transfer will stay open after the file # transfer and cause the command to timeout. @@ -206,23 +213,23 @@ get_transfer() # tcmd_extra="" if nc -h 2>&1 | grep -qw -- -N; then - tcmd_extra+=" -N " + tcmd_extra+="-N" wsrep_log_info "Using nc -N" fi # netcat doesn't understand [] around IPv6 address if nc -h 2>&1 | grep -q ncat;then # Ncat - wsrep_log_info "Using Ncat as streamer" - tcmd="nc ${tcmd_extra} ${REMOTEIP//[\[\]]/} ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then + wsrep_log_info "Using Ncat as streamer" + tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" + elif nc -h 2>&1 | grep -qw -- '-d\>';then # Debian netcat - wsrep_log_info "Using Debian netcat as streamer" - tcmd="nc ${tcmd_extra} ${REMOTEIP//[\[\]]/} ${TSST_PORT}" + wsrep_log_info "Using Debian netcat as streamer" + tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" else # traditional netcat - wsrep_log_info "Using traditional netcat as streamer" - tcmd="nc -q0 ${tcmd_extra} ${REMOTEIP//[\[\]]/} ${TSST_PORT}" + wsrep_log_info "Using traditional netcat as streamer" + tcmd="nc -q0 ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" fi fi else @@ -540,25 +547,11 @@ kill_xtrabackup() setup_ports() { + SST_PORT=${WSREP_SST_OPT_ADDR_PORT} if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];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 }') - lsn=$(echo $remain | awk -F '[:/]' '{ print $3 }') - sst_ver=$(echo $remain | awk -F '[:/]' '{ print $4 }') - else - SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }') - REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }') - lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }') - sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }') - fi - else - 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 }') - fi + REMOTEIP=${WSREP_SST_OPT_HOST} + lsn=${WSREP_SST_OPT_LSN} + sst_ver=${WSREP_SST_OPT_SST_VER} fi } |