mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
fix(backups): fail a ClickHouse backup whose operation the sidecar lost
The sidecar keeps its action log only in memory, so a sidecar restart
after create_remote was accepted drops the operation's row, and the
strategy kept polling for it forever under a Job with no deadline.
Until now the resumed upload re-added a row ending in the archive name
and ended the loop, but resume is now off so a failed attempt never
reaches the bucket, which leaves nothing to end it. The row is logged
before the POST is acknowledged, so its absence means the operation is
gone and the attempt has to fail.
Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit d0a73302d9)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
1 parent
8b76529539
commit
1e5e3a45df
1 file changed
+7
@@ -122,6 +122,13 @@ spec:
|
||||
row=$(curl -fsS ${auth} "${api}/backup/actions" \
|
||||
| jq -rs --arg suffix "${target}" \
|
||||
'[.[] | select((.command // "") | endswith($suffix))] | sort_by(.start) | last')
|
||||
# The sidecar logs the operation before acknowledging the POST
|
||||
# and keeps that log only in memory, so a missing row means it
|
||||
# restarted and the operation is gone; nothing will resume it.
|
||||
if [ "${row}" = "null" ]; then
|
||||
echo "operation ${target} is no longer in the sidecar action log; the sidecar restarted and dropped it" >&2
|
||||
exit 1
|
||||
fi
|
||||
status=$(echo "${row}" | jq -r '.status // ""')
|
||||
case "${status}" in
|
||||
success) echo "operation succeeded" ; exit 0 ;;
|
||||
|
||||
Reference in new issue
Block a user