galera SST scripts: removing obsolete xtrabackup_pid support

Removed handling of the long-unsupported xtrabackup_pid file,
as it is not even created by modern versions of mariabackup.
Instead, added stopping of the asynchronous process that
mariabackup runs (if it is still active) to the exception
handler.
This commit is contained in:
Julius Goryavsky 2024-09-10 03:45:19 +02:00
parent 5cb436e07b
commit fbd8829149
2 changed files with 21 additions and 23 deletions

View File

@ -687,16 +687,16 @@ cleanup_at_exit()
fi fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
if [ -n "$BACKUP_PID" ]; then
if ps -p $BACKUP_PID >/dev/null 2>&1; then
wsrep_log_error \
"mariadb-backup process is still running. Killing..."
cleanup_pid $CHECK_PID
fi
fi
wsrep_log_info "Removing the sst_in_progress file" wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file wsrep_cleanup_progress_file
else else
if [ -n "$BACKUP_PID" ]; then
if check_pid "$BACKUP_PID" 1; then
wsrep_log_error \
"mariadb-backup process is still running. Killing..."
cleanup_pid $CHECK_PID "$BACKUP_PID"
fi
fi
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || :
fi fi
@ -906,14 +906,14 @@ monitor_process()
local sst_stream_pid=$1 local sst_stream_pid=$1
while :; do while :; do
if ! ps -p "$WSREP_SST_OPT_PARENT" >/dev/null 2>&1; then if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then
wsrep_log_error \ wsrep_log_error \
"Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \ "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \
"terminated unexpectedly." "terminated unexpectedly."
kill -- -"$WSREP_SST_OPT_PARENT" kill -- -$WSREP_SST_OPT_PARENT
exit 32 exit 32
fi fi
if ! ps -p "$sst_stream_pid" >/dev/null 2>&1; then if ! ps -p $sst_stream_pid >/dev/null 2>&1; then
break break
fi fi
sleep 0.1 sleep 0.1
@ -1073,7 +1073,7 @@ SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete: # give some time for previous SST to complete:
check_round=0 check_round=0
while check_pid "$SST_PID" 0; do while check_pid "$SST_PID"; do
wsrep_log_info "previous SST is not completed, waiting for it to exit" wsrep_log_info "previous SST is not completed, waiting for it to exit"
check_round=$(( check_round+1 )) check_round=$(( check_round+1 ))
if [ $check_round -eq 30 ]; then if [ $check_round -eq 30 ]; then
@ -1220,9 +1220,6 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
exit 22 exit 22
fi fi
# mariadb-backup implicitly writes PID to fixed location in $xtmpdir
BACKUP_PID="$xtmpdir/xtrabackup_pid"
else # BYPASS FOR IST else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST" wsrep_log_info "Bypassing the SST for IST"
@ -1402,7 +1399,7 @@ else # joiner
fi fi
mkdir -p "$DATA/.sst" mkdir -p "$DATA/.sst"
(recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) & (recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) &
jpid=$! BACKUP_PID=$!
wsrep_log_info "Proceeding with SST" wsrep_log_info "Proceeding with SST"
get_binlog get_binlog
@ -1447,6 +1444,7 @@ else # joiner
# Deleting files from previous SST and legacy files from old versions: # Deleting files from previous SST and legacy files from old versions:
[ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary" [ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary"
[ -f "$DATA/xtrabackup_pid" ] && rm -f "$DATA/xtrabackup_pid"
[ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints"
[ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info"
[ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info"
@ -1457,7 +1455,8 @@ else # joiner
MAGIC_FILE="$DATA/$INFO_FILE" MAGIC_FILE="$DATA/$INFO_FILE"
wsrep_log_info "Waiting for SST streaming to complete!" wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid monitor_process $BACKUP_PID
BACKUP_PID=""
if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then
wsrep_log_error "xtrabackup_checkpoints missing," \ wsrep_log_error "xtrabackup_checkpoints missing," \

View File

@ -351,7 +351,7 @@ SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete: # give some time for previous SST to complete:
check_round=0 check_round=0
while check_pid "$SST_PID" 0; do while check_pid "$SST_PID"; do
wsrep_log_info "Previous SST is not completed, waiting for it to exit" wsrep_log_info "Previous SST is not completed, waiting for it to exit"
check_round=$(( check_round+1 )) check_round=$(( check_round+1 ))
if [ $check_round -eq 20 ]; then if [ $check_round -eq 20 ]; then
@ -866,19 +866,18 @@ EOF
echo "ready $ADDR:$RSYNC_PORT/$MODULE" echo "ready $ADDR:$RSYNC_PORT/$MODULE"
MYSQLD_PID="$WSREP_SST_OPT_PARENT"
# wait for SST to complete by monitoring magic file # wait for SST to complete by monitoring magic file
while [ ! -r "$MAGIC_FILE" ] && check_pid "$TRANSFER_PID" && \ while [ ! -r "$MAGIC_FILE" ] && check_pid "$TRANSFER_PID" && \
ps -p $MYSQLD_PID >/dev/null 2>&1 ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1
do do
sleep 1 sleep 1
done done
if ! ps -p $MYSQLD_PID >/dev/null 2>&1; then if ! ps -p $WSREP_SST_OPT_PARENT >/dev/null 2>&1; then
wsrep_log_error \ wsrep_log_error \
"Parent mysqld process (PID: $MYSQLD_PID) terminated unexpectedly." "Parent mysqld process (PID: $WSREP_SST_OPT_PARENT)" \
kill -- -$MYSQLD_PID "terminated unexpectedly."
kill -- -$WSREP_SST_OPT_PARENT
sleep 1 sleep 1
exit 32 exit 32
fi fi