Skip to content

Commit e62dabe

Browse files
Tobias Pfaffelmoserclaude
andcommitted
fix: harden qdrant restore script and align restore .env example
Follow-up to feat/auto-fetch-collections-from-s3 with three small fixes surfaced during review. - track_collection: skip the read loop when the jq result is empty. Bash here-strings always append a newline, so `done <<< ""` would otherwise iterate once with an empty item and write a bogus `host,` line to $QDRANT_COLLECTIONS_FILE. Affects `get_coll` against an empty source. - generate_snapshot_file_from_s3: fix word order in the non-error exit message so the filename lands in the correct position. - UPGRADE-OPERATIONS.md restore example: set QDRANT_SOURCE_HOSTS="" to match the new restore-from-S3-only contract used by the k8s manifests; move the port-forward note to QDRANT_RESTORE_HOSTS where it belongs. - Sync configmap-script.yaml via config_map_updater.sh. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4f6a4be commit e62dabe

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

UPGRADE-OPERATIONS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,11 +737,11 @@ nano .env
737737
# Qdrant API key
738738
export QDRANT_API_KEY="your-api-key-here"
739739

740-
# Source hosts (where snapshots are stored)
741-
# Port forward qdrant service to local
742-
export QDRANT_SOURCE_HOSTS="http://localhost:6333"
740+
# Source hosts (leave empty for restore - collections are discovered from S3)
741+
export QDRANT_SOURCE_HOSTS=""
743742

744743
# Restore hosts (target Qdrant instances)
744+
# Port forward qdrant service to local
745745
export QDRANT_RESTORE_HOSTS="http://localhost:6334"
746746

747747
# S3 configuration (for fetching snapshots)

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ data:
112112
local result="$2"
113113
_result=$(jq -c '.result.collections // [] | .[]' <<< "$result")
114114
115+
# Guard against the bash `<<<` quirk: a here-string of an empty value still
116+
# produces a single newline, so the loop below would iterate once with an
117+
# empty item and write a bogus `host,` line to $QDRANT_COLLECTIONS_FILE.
118+
if [[ -z "$_result" ]]; then
119+
return
120+
fi
121+
115122
while read -r item; do
116123
local collection_name=""
117124
collection_name=$(jq -r '.name' <<< "$item")
@@ -403,7 +410,7 @@ data:
403410
fi
404411
405412
if [ ! -f "$QDRANT_COLLECTIONS_FILE" ]; then
406-
_printf "non error exit since file does not %s exist.\n" "$QDRANT_COLLECTIONS_FILE"
413+
_printf "non error exit since file %s does not exist.\n" "$QDRANT_COLLECTIONS_FILE"
407414
exit 0
408415
fi
409416

qdrant-backup-restore/qdrant_backup_recovery.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ track_collection(){
103103
local result="$2"
104104
_result=$(jq -c '.result.collections // [] | .[]' <<< "$result")
105105

106+
# Guard against the bash `<<<` quirk: a here-string of an empty value still
107+
# produces a single newline, so the loop below would iterate once with an
108+
# empty item and write a bogus `host,` line to $QDRANT_COLLECTIONS_FILE.
109+
if [[ -z "$_result" ]]; then
110+
return
111+
fi
112+
106113
while read -r item; do
107114
local collection_name=""
108115
collection_name=$(jq -r '.name' <<< "$item")
@@ -394,7 +401,7 @@ generate_snapshot_file_from_s3() {
394401
fi
395402

396403
if [ ! -f "$QDRANT_COLLECTIONS_FILE" ]; then
397-
_printf "non error exit since file does not %s exist.\n" "$QDRANT_COLLECTIONS_FILE"
404+
_printf "non error exit since file %s does not exist.\n" "$QDRANT_COLLECTIONS_FILE"
398405
exit 0
399406
fi
400407

0 commit comments

Comments
 (0)