Skip to content

Commit 451a7e2

Browse files
Update ConfigMap with latest script changes
1 parent eadef54 commit 451a7e2

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

qdrant-backup-restore/k8s/configmap-script.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ data:
268268
return
269269
fi
270270
271-
item=$(jq -c '.result[0] // empty' <<< "$result")
272-
273271
_result=$(jq -c '.result // [] | .[]' <<< "$result")
274272
while read -r item; do
275273
local snapshot_name=""
@@ -411,10 +409,12 @@ data:
411409
local status=""
412410
status=$(jq -r '.status?' <<< "$result")
413411
if [ "$status" != "success" ]; then
414-
_printf "[%s] failed to fetch snapshots for collections %s, got this instead %s\n" "$host" "$collection_name" "${result//[[:space:]]/}"
412+
_printf "failed to fetch snapshots for collections %s, got this instead %s\n" "$collection_name" "${result//[[:space:]]/}"
413+
return 1
415414
fi
416415
417416
s3_presigned_url=$(jq -r '.share' <<< "$result")
417+
return 0
418418
}
419419
420420
# restores an collection snapshot from an s3 url updates the $QDRANT_SNAPSHOT_RECOVERY_HISTORY_FILE and $QDRANT_FAILED_RECOVERY_FILE
@@ -427,7 +427,12 @@ data:
427427
428428
_printf "[%s] started to recover %s snapshot of %s collection...\n" "$host" "$snapshot_name" "$collection_name"
429429
430-
get_s3_url "$collection_name" "$snapshot_name"
430+
if ! get_s3_url "$collection_name" "$snapshot_name"; then
431+
((fail_recovered_count=fail_recovered_count+1))
432+
_printf "[%s] failed to presign S3 URL for %s snapshot of %s collection, skipping recover request\n" "$host" "$snapshot_name" "$collection_name"
433+
printf '%s,%s,%s\n' "$host" "$snapshot_name" "presign_failed" >> $QDRANT_FAILED_RECOVERY_FILE
434+
return
435+
fi
431436
432437
result=$(_curl PUT \
433438
"$host/collections/$collection_name/snapshots/recover?wait=$QDRANT_WAIT_ON_TASK" \
@@ -607,13 +612,9 @@ data:
607612
fi
608613
fi
609614
610-
if [[ ! -s "$QDRANT_COLLECTION_ALIASES" ]]; then
611-
get_collection_aliases
612-
fi
613-
614615
if [ ! -f "$QDRANT_COLLECTION_ALIASES" ]; then
615-
_printf "[%s] collection aliases do not exist on source!\n" "$host"
616-
return
616+
_printf "collection aliases file does not exist, run 'get_colla' task to fetch collection aliases from source hosts or enable BACKUP_COLLECTION_ALIASES_ON_S3 to fetch collection aliases from S3 bucket\n"
617+
exit 0
617618
fi
618619
619620
colla_count=$(wc -l < $QDRANT_COLLECTION_ALIASES)
@@ -678,7 +679,7 @@ data:
678679
done <<< "$peer_uri_entries"
679680
680681
if [ ${#peer_uri_map[@]} -eq 0 ]; then
681-
_printf "no registered host peers in %s... exiting" "$host"
682+
_printf "no registered host peers in %s... exiting\n" "$host"
682683
exit 1
683684
fi
684685
}

0 commit comments

Comments
 (0)