← Back to team overview

maria-developers team mailing list archive

Re: 44692f17a62: MDEV-15436: If log_bin and log_bin_index is different SST with rsync fails.

 

Hi, Jan!

On Aug 31, serg@xxxxxxxxxxx wrote:
> revision-id: 44692f17a621d7f0261d84b97a7334352463038c (mariadb-10.2.16-6-g44692f17a62)
> parent(s): 7d0d934ca642e485b2c008727dc20c83e26cce10
> author: Jan Lindström
> committer: Jan Lindström
> timestamp: 2018-06-26 12:56:19 +0300
> message:
> 
> MDEV-15436: If log_bin and log_bin_index is different SST with rsync fails.
> 
> Problem was that in SST log_bin_index name and directory was not
> handled and passed to rsync SST script.
> 
>  mysql-test/suite/galera/r/galera_sst_rsync2.result | 396 +++++++++++++++++++++
>  mysql-test/suite/galera/t/galera_sst_rsync2.cnf    |  15 +
>  mysql-test/suite/galera/t/galera_sst_rsync2.test   |  12 +

I didn't review the test, but I presume you've verified that it fails
without the bug fix.

> diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
> index 05c99880d75..6886d2ce1e1 100644
> --- a/scripts/wsrep_sst_rsync.sh
> +++ b/scripts/wsrep_sst_rsync.sh
> @@ -132,6 +132,12 @@ then
>      BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG)
>  fi
>  
> +if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
> +then
> +    BINLOG_INDEX_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG_INDEX)
> +    BINLOG_INDEX_FILENAME=$(basename $WSREP_SST_OPT_BINLOG_INDEX)
> +fi
> +
>  WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
>  # if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
>  if [ -z "$WSREP_LOG_DIR" ]; then
> @@ -204,12 +210,20 @@ then
>              OLD_PWD="$(pwd)"
>              cd $BINLOG_DIRNAME
>  
> -            binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
> +            if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]

first, I think it'd be simpler to do, like

  if [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
  then
      WSREP_SST_OPT_BINLOG_INDEX=$WSREP_SST_OPT_BINLOG.index
  fi

it's enough to do it once before setting BINLOG_INDEX_DIRNAME and
BINLOG_INDEX_FILENAME and you woudn't need if's here and below.

second, you apparently are trying to take into account that binlog index
may be a different directory. Please use this configuration in your test
case, put binlog index in a different directory.

otherwise ok. please, push after adjusting the test case to put binlog
index in a different directory.

> +               binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index)
> +            then
> +               cd $BINLOG_INDEX_DIRNAME
> +               binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_INDEX_FILENAME}.index)
> +            fi
> +
> +            cd $BINLOG_DIRNAME
>              binlog_files=""
>              for ii in $binlog_files_full
>              do
>                  binlog_files="$binlog_files $(basename $ii)"
>              done
> +
>              if ! [ -z "$binlog_files" ]
>              then
>                  wsrep_log_info "Preparing binlog files for transfer:"
> @@ -391,7 +405,11 @@ EOF
>              tar -xvf $BINLOG_TAR_FILE >&2
>              for ii in $(ls -1 ${BINLOG_FILENAME}.*)
>              do
> -                echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
> +                if ! [ -z $WSREP_SST_OPT_BINLOG_INDEX ]
> +                  echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index
> +		then
> +                  echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_INDEX_DIRNAME}/${BINLOG_INDEX_FILENAME}.index
> +                fi
>              done
>          fi
>          cd "$OLD_PWD"

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx