[MDEV-14299] /usr//bin/wsrep_sst_xtrabackup-v2: line 646: WSREP_SST_OPT_PORT: unbound variable Created: 2017-11-06  Updated: 2017-11-13  Resolved: 2017-11-07

Status: Closed
Project: MariaDB Server
Component/s: Galera SST
Affects Version/s: 10.2.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Marcelo Altmann Assignee: Andrii Nikitin (Inactive)
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-14256 MariaDB 10.2.10 can't SST with xtraba... Closed
Problem/Incident
is caused by MDEV-13968 sst fails with "WSREP_SST_OPT_PORT: r... Closed

 Description   

This issue is probably a regression of the work done on MDEV-13968.

2017-11-05 16:56:36 139938966841088 [Note] WSREP: State transfer required: 
Group state: 8367c6fb-c25c-11e7-adf7-73c825aa596d:366 
Local state: 00000000-0000-0000-0000-000000000000:-1 
2017-11-05 16:56:36 139938966841088 [Note] WSREP: New cluster view: global state: 8367c6fb-c25c-11e7-adf7-73c825aa596d:366, view# 8: Primary, number of nodes: 2, my index: 0, protocol version 3 
2017-11-05 16:56:36 139938966841088 [Warning] WSREP: Gap in state sequence. Need state transfer. 
2017-11-05 16:56:36 139928121878272 [Note] WSREP: Running: 'wsrep_sst_xtrabackup-v2 --role 'joiner' --address '10.176.112.45' --datadir '/u01/sqldata/' --parent '27353' '' ' 
/usr//bin/wsrep_sst_xtrabackup-v2: line 646: WSREP_SST_OPT_PORT: unbound variable 
2017-11-05 16:56:36 139928121878272 [ERROR] WSREP: Failed to read 'ready <addr>' from: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '10.176.112.45' --datadir '/u01/sqldata/' --parent '27353' '' 
Read: '(null)' 
2017-11-05 16:56:36 139928121878272 [ERROR] WSREP: Process completed with error: wsrep_sst_xtrabackup-v2 --role 'joiner' --address '10.176.112.45' --datadir '/u01/sqldata/' --parent '27353' '' : 1 (Operation not permitted) 
2017-11-05 16:56:36 139938966841088 [ERROR] WSREP: Failed to prepare for 'xtrabackup-v2' SST. Unrecoverable. 
2017-11-05 16:56:36 139938966841088 [ERROR] Aborting

If your --address doesn't have a port host:port and you don't specify --port WSREP_SST_OPT_PORT will never be set and will result in an unbound variable error on wsrep_sst_xtrabackup-V2 script :

if [ -n "${WSREP_SST_OPT_ADDR_PORT:-}" ]; then
  if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then
    if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then
      wsrep_log_error "port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR"
      exit 2
    fi
  else
    readonly WSREP_SST_OPT_PORT="$WSREP_SST_OPT_ADDR_PORT"
  fi
fi

Possibly we need to move the else block to the outer if:

if [ -n "${WSREP_SST_OPT_ADDR_PORT:-}" ]; then
  if [ -n "${WSREP_SST_OPT_PORT:-}" ]; then
    if [ "$WSREP_SST_OPT_PORT" != "$WSREP_SST_OPT_ADDR_PORT" ]; then
      wsrep_log_error "port in --port=$WSREP_SST_OPT_PORT differs from port in --address=$WSREP_SST_OPT_ADDR"
      exit 2
    fi
  fi
else
  readonly WSREP_SST_OPT_PORT="$WSREP_SST_OPT_ADDR_PORT"
fi



 Comments   
Comment by Andrii Nikitin (Inactive) [ 2017-11-07 ]

Thank you for analysis. I am marking this as duplicate of MDEV-14256 . It has some possible workarounds.
I don't think that your workaround is correct for all cases, e.g. when --port option is provided to sst. Or maybe this is correct fix

Comment by Sergei Golubchik [ 2017-11-13 ]

This patch will leave WSREP_SST_OPT_PORT unset if address is specified with a port like --address 10.176.112.45:12345

I hope the attached patch in MDEV-14256 will work

Generated at Thu Feb 08 08:12:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.