fix: close internal semantic review gaps
This commit is contained in:
@@ -28,6 +28,9 @@ output_name=$(basename "$output")
|
||||
[ -d "$output_dir" ] || { echo "backup destination directory does not exist" >&2; exit 2; }
|
||||
|
||||
expected_volume_name="${project_name}_${volume_role}"
|
||||
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
|
||||
. "$script_dir/lib/vector-operation-lock.sh"
|
||||
vector_operation_lock_init
|
||||
|
||||
resolve_volume() {
|
||||
names=$(docker volume ls \
|
||||
@@ -55,24 +58,32 @@ validate_volume_metadata() {
|
||||
[ "${3-}" = "$volume_role" ] || { echo "volume metadata role label mismatch" >&2; exit 2; }
|
||||
}
|
||||
|
||||
volume_name=$(resolve_volume)
|
||||
validate_volume_metadata "$volume_name"
|
||||
|
||||
running_container=$(docker compose --project-name "$project_name" ps --status running -q qdrant)
|
||||
restart_qdrant=0
|
||||
temporary_output=
|
||||
cleanup() {
|
||||
status=$?
|
||||
trap - EXIT HUP INT TERM
|
||||
if [ -n "${temporary_output:-}" ] && [ -e "${temporary_output:-}" ]; then
|
||||
rm -f "$temporary_output"
|
||||
fi
|
||||
if [ "$restart_qdrant" -eq 1 ]; then
|
||||
docker compose --project-name "$project_name" start qdrant >/dev/null
|
||||
if ! docker compose --project-name "$project_name" start qdrant >/dev/null; then
|
||||
echo "Unable to restart Qdrant after backup" >&2
|
||||
[ "$status" -ne 0 ] || status=1
|
||||
fi
|
||||
fi
|
||||
if ! release_vector_operation_lock; then
|
||||
[ "$status" -ne 0 ] || status=1
|
||||
fi
|
||||
exit "$status"
|
||||
}
|
||||
trap cleanup EXIT HUP INT TERM
|
||||
|
||||
acquire_vector_operation_lock
|
||||
volume_name=$(resolve_volume)
|
||||
validate_volume_metadata "$volume_name"
|
||||
running_container=$(docker compose --project-name "$project_name" ps --status running -q qdrant)
|
||||
|
||||
if [ -n "$running_container" ]; then
|
||||
docker compose --project-name "$project_name" stop qdrant >/dev/null
|
||||
restart_qdrant=1
|
||||
|
||||
Reference in New Issue
Block a user