From bcab0e8eb97be32187c2038bdbfdc95218fe020f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 5 Sep 2024 09:37:06 +0300 Subject: [PATCH] MDEV-34856 : Galera Cluster upgrade from 11.0 to 11.1 fails, eventually leads to crash This is regression from MDEV-18931 Rename Mariabackup's xtrabackup_* files to mariadb_backup_* commit b314f7b6 caused by fact that SST expects to find mariabackup_galera_info file but it does not exists if mariabackup backup is from older releases. Older releases have xtrabackup_galera_info file. If mariabackup_galera_info file does not exists we move old xtrabackup_galera_info to mariabackup_galera_info file. This will allow rolling upgrade from older releases to new releases using new name. Note that SST method rsync is not effected. Manually tested by starting 2-node cluster with 10.11 binary, issued shutdown to second node and starting second node with 11.4 binary. --- extra/mariabackup/backup_copy.cc | 1 + scripts/wsrep_sst_mariabackup.sh | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index a328f5e0ec702..1051ea70f694a 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1808,6 +1808,7 @@ copy_back() MB_BINLOG_INFO, MB_METADATA_FILENAME, XTRABACKUP_BINLOG_INFO, + XTRABACKUP_GALERA_INFO, XTRABACKUP_METADATA_FILENAME, ".qp", ".pmap", ".tmp", NULL}; diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index f66a13f17ca3e..b94a93bde3a75 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -104,6 +104,7 @@ fi DATA="$WSREP_SST_OPT_DATA" INFO_FILE='mariadb_backup_galera_info' +INFO_FILE_OLD='xtrabackup_galera_info' DONOR_INFO_FILE='donor_galera_info' IST_FILE='xtrabackup_ist' MAGIC_FILE="$DATA/$INFO_FILE" @@ -681,8 +682,8 @@ cleanup_at_exit() if [ $estatus -ne 0 ]; then wsrep_log_error "Removing $MAGIC_FILE file due to signal" - [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || : - [ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || : + [ -f "$MAGIC_FILE" ] && rm -rf "$MAGIC_FILE" || : + [ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE" || : fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then @@ -846,6 +847,14 @@ recv_joiner() done if [ $checkf -eq 1 ]; then + if [ ! -r "$MAGIC_FILE" ]; then + if [ -r "$DATA/$INFO_FILE_OLD" ]; then + wsrep_log_info "Backup from old release file ($DATA/$INFO_FILE_OLD)" \ + " exists but not ($MAGIC_FILE)" + mv -f "$DATA/$INFO_FILE_OLD" "$MAGIC_FILE" + fi + fi + if [ ! -r "$MAGIC_FILE" ]; then # this message should cause joiner to abort: wsrep_log_error "receiving process ended without creating" \ @@ -919,7 +928,7 @@ monitor_process() done } -[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" +[ -f "$MAGIC_FILE" ] && rm -rf "$MAGIC_FILE" [ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE" read_cnf @@ -1337,8 +1346,8 @@ else # joiner [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" # May need mariadb_backup_checkpoints later on - [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" - [ -f "$DATA/mariadb_backup_galera_info" ] && rm -f "$DATA/mariadb_backup_galera_info" + [ -f "$DATA/xtrabackup_binary" ] && rm -rf "$DATA/xtrabackup_binary" + [ -f "$DATA/mariadb_backup_galera_info" ] && rm -rf "$DATA/mariadb_backup_galera_info" ADDR="$WSREP_SST_OPT_HOST" @@ -1450,9 +1459,19 @@ else # joiner wsrep_log_info "Waiting for SST streaming to complete!" monitor_process $jpid + if [ ! -s "$DATA/mariadb_backup_checkpoints" ]; then + if [ -s "$DATA/xtrabackup_checkpoints" ]; then + wsrep_log_info "Backup from old release file ($DATA/xtrabackup_checkpoints)" \ + " exists but not ($DATA/mariadb_backup_checkpoints)" + mv -f "$DATA/xtrabackup_checkpoints" "$DATA/mariadb_backup_checkpoints" + fi + fi + if [ ! -s "$DATA/mariadb_backup_checkpoints" ]; then wsrep_log_error "mariadb_backup_checkpoints missing," \ "failed mariadb-backup/SST on donor" + wsrep_log_info "Contents of datadir:" + wsrep_log_info $(ls -l "$dir/"*) exit 2 fi