Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10853

netcat help output in error log when running xtrabackup SST

Details

    Description

      The feature check for "ncat" in the XtraBackup SST scripts only works on CentOS 7, on other distributions it leads to full netcat help output being written to the error log instead.

      This is due to the nc version in CentOS 7 writing help output to stdout, while the version in CentOS 6, and in Ubuntu 16.04, write to stderr instead.

      Redirecting stderr to stdout with 2>&1 should make the check work for all versions of netcat:

      if nc -h 2>&1 | grep -q ncat;then

      instead of current

      if nc -h | grep -q ncat;then

      The feature check for "ncat" only works on CentOS 7, on other distributions it leads to full netcat help output being written to the error log instead.

      This is due to the nc version in CentOS 7 writing help output to stdout, while the version in CentOS 6, and in Ubuntu 16.04, write to stderr instead.

      Attachments

        Activity

          Proposed fix:

          diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh
          index a836d5e..6e7dde3 100644
          --- a/scripts/wsrep_sst_xtrabackup-v2.sh
          +++ b/scripts/wsrep_sst_xtrabackup-v2.sh
          @@ -176,7 +176,7 @@ get_transfer()
                   fi
                   wsrep_log_info "Using netcat as streamer"
                   if [[ "$WSREP_SST_OPT_ROLE"  == "joiner" ]];then
          -            if nc -h | grep -q ncat;then 
          +            if nc -h 2>&1 | grep -q ncat;then 
                           tcmd="nc -l ${TSST_PORT}"
                       else 
                           tcmd="nc -dl ${TSST_PORT}"
          diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh
          index 2247ede..816c53e 100644
          --- a/scripts/wsrep_sst_xtrabackup.sh
          +++ b/scripts/wsrep_sst_xtrabackup.sh
          @@ -149,7 +149,7 @@ get_transfer()
                   fi
                   wsrep_log_info "Using netcat as streamer"
                   if [[ "$WSREP_SST_OPT_ROLE"  == "joiner" ]];then
          -            if nc -h | grep -q ncat;then 
          +            if nc -h 2>&1 | grep -q ncat;then 
                           tcmd="nc -l ${TSST_PORT}"
                       else 
                           tcmd="nc -dl ${TSST_PORT}"
          

          hholzgra Hartmut Holzgraefe added a comment - Proposed fix: diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index a836d5e..6e7dde3 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -176,7 +176,7 @@ get_transfer() fi wsrep_log_info "Using netcat as streamer" if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h | grep -q ncat;then + if nc -h 2>&1 | grep -q ncat;then tcmd="nc -l ${TSST_PORT}" else tcmd="nc -dl ${TSST_PORT}" diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index 2247ede..816c53e 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -149,7 +149,7 @@ get_transfer() fi wsrep_log_info "Using netcat as streamer" if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h | grep -q ncat;then + if nc -h 2>&1 | grep -q ncat;then tcmd="nc -l ${TSST_PORT}" else tcmd="nc -dl ${TSST_PORT}"

          People

            nirbhay_c Nirbhay Choubey (Inactive)
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.