@@ -62,57 +62,38 @@ function request_streaming() {
6262 set +o errexit
6363 log ' INFO' ' Garbd was started'
6464 garbd \
65- --address " gcomm://$NODE_NAME .$PXC_SERVICE ?gmcast.listen_addr=tcp://0.0.0.0:4567" \
66- --donor " $NODE_NAME " \
67- --group " $PXC_SERVICE " \
68- --options " $GARBD_OPTS " \
69- --sst " xtrabackup-v2:$LOCAL_IP :4444/xtrabackup_sst//1" \
70- --recv-script=" /opt/percona/backup/run_backup.sh" 2>&1 | tee /tmp/garbd.log
71-
72- local sst_info_path
73- if [[ -n $S3_BUCKET || -n $AZURE_CONTAINER_NAME ]]; then
74- sst_info_path=" /tmp/${SST_INFO_NAME} "
75- else
76- sst_info_path=" ${BACKUP_DIR} /${SST_INFO_NAME} "
77- fi
78-
79- MYSQL_VERSION=$( parse_ini ' mysql-version' " $sst_info_path " )
80- if ! check_for_version " $MYSQL_VERSION " ' 8.0.0' ; then
81- if grep ' State transfer request failed' /tmp/garbd.log; then
82- exit 1
83- fi
84- if grep ' WARN: Protocol violation. JOIN message sender ... (garb) is not in state transfer' /tmp/garbd.log; then
85- exit 1
86- fi
87- if grep ' WARN: Rejecting JOIN message from ... (garb): new State Transfer required.' /tmp/garbd.log; then
88- exit 1
89- fi
90- if grep ' INFO: Shifting CLOSED -> DESTROYED (TO: -1)' /tmp/garbd.log; then
91- exit 1
92- fi
93- if ! grep ' INFO: Sending state transfer request' /tmp/garbd.log; then
94- exit 1
95- fi
96- else
97- if grep ' Will never receive state. Need to abort' /tmp/garbd.log; then
98- exit 1
99- fi
100-
101- if grep ' Donor is no longer in the cluster, interrupting script' /tmp/garbd.log; then
102- exit 1
103- elif grep ' failed: Invalid argument' /tmp/garbd.log; then
104- exit 1
105- fi
106- fi
107-
108- if [ -f ' /tmp/backup-is-completed' ]; then
109- log ' INFO' ' Backup was finished successfully'
110- exit 0
111- fi
112-
113- log ' ERROR' ' Backup was finished unsuccessful'
114-
115- exit 1
65+ --address " gcomm://$NODE_NAME .$PXC_SERVICE ?gmcast.listen_addr=tcp://0.0.0.0:4567" \
66+ --donor " $NODE_NAME " \
67+ --group " $PXC_SERVICE " \
68+ --options " $GARBD_OPTS " \
69+ --sst " xtrabackup-v2:$LOCAL_IP :4444/xtrabackup_sst//1" \
70+ --extended-exit-codes \
71+ --wait-for-recv-script-exit \
72+ --recv-script=" /usr/bin/run_backup.sh"
73+ GARBD_EXIT_CODE=$?
74+
75+ case ${GARBD_EXIT_CODE} in
76+ 0)
77+ log ' INFO' ' Backup was finished successfully'
78+ exit 0
79+ ;;
80+ 100)
81+ log ' ERROR' ' Backup was unsuccessful: Generic failure'
82+ exit 1
83+ ;;
84+ 101)
85+ log ' ERROR' ' Backup was unsuccessful: Donor disappeared'
86+ exit 1
87+ ;;
88+ 102)
89+ log ' ERROR' ' Backup was unsuccessful: SST request failure'
90+ exit 1
91+ ;;
92+ * )
93+ log ' ERROR' " Backup was unsuccessful: garbd exited with ${GARBD_EXIT_CODE} "
94+ exit 1
95+ ;;
96+ esac
11697}
11798
11899# TODO: should i remove it?
0 commit comments