fix: close semantic isolation review gaps
This commit is contained in:
@@ -150,12 +150,28 @@ fi
|
||||
if [ "$1" = compose ] && [ "$2" = --project-name ]; then
|
||||
case "$4" in
|
||||
ps)
|
||||
if [ "${QDRANT_RUNNING:-1}" = 1 ]; then
|
||||
qdrant_state=${QDRANT_RUNNING:-1}
|
||||
if [ -n "${QDRANT_STATE_FILE:-}" ] && [ -f "$QDRANT_STATE_FILE" ]; then
|
||||
qdrant_state=$(cat "$QDRANT_STATE_FILE")
|
||||
fi
|
||||
if [ "$qdrant_state" = 1 ]; then
|
||||
printf '%s\n' qdrant-container
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
stop|start)
|
||||
stop)
|
||||
if [ -n "${QDRANT_STATE_FILE:-}" ]; then
|
||||
printf '%s\n' 0 >"$QDRANT_STATE_FILE"
|
||||
fi
|
||||
if [ "${STOP_MARKS_STOPPED_THEN_FAIL:-0}" = 1 ]; then
|
||||
exit 42
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
start)
|
||||
if [ -n "${QDRANT_STATE_FILE:-}" ]; then
|
||||
printf '%s\n' 1 >"$QDRANT_STATE_FILE"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
@@ -525,4 +541,53 @@ grep -q "compose --project-name $project stop qdrant" "$rollback_log"
|
||||
grep -q "compose --project-name $project start qdrant" "$rollback_log"
|
||||
test ! -e "$tmp/locks/$lock_name"
|
||||
|
||||
assert_ambiguous_stop_reconciled() {
|
||||
operation=$1
|
||||
operation_log="$tmp/$operation-ambiguous-stop.log"
|
||||
operation_state="$tmp/$operation-qdrant-state"
|
||||
foreign_lock="$tmp/locks/foreign-$operation-lock"
|
||||
printf '%s\n' 1 >"$operation_state"
|
||||
mkdir -p "$foreign_lock"
|
||||
printf '%s\n' foreign-owner >"$foreign_lock/owner"
|
||||
printf '%s\n' foreign-volume >"$foreign_lock/volume"
|
||||
|
||||
if [ "$operation" = backup ]; then
|
||||
set -- ./scripts/vector-backup.sh --project-name "$project" \
|
||||
--output "$tmp/ambiguous-stop-backup.tar"
|
||||
else
|
||||
set -- ./scripts/vector-restore.sh --project-name "$project" \
|
||||
--input "$restore_input" --confirm-project "$project"
|
||||
fi
|
||||
|
||||
if PATH="$fakebin:$PATH" DOCKER_LOG="$operation_log" PROJECT_NAME="$project" \
|
||||
VOLUME_ROOT="$volume_root" QDRANT_STATE_FILE="$operation_state" \
|
||||
STOP_MARKS_STOPPED_THEN_FAIL=1 \
|
||||
HELPER_IMAGE="qdrant/qdrant:v1.18.2@sha256:75eab8c4ba42096724fdcfde8b4de0b5713d529dde32f285a1f86fdcb2c9e50c" \
|
||||
"$@" >"$tmp/$operation-ambiguous-stop.out" \
|
||||
2>"$tmp/$operation-ambiguous-stop.err"; then
|
||||
echo "$operation hid an ambiguous qdrant stop failure" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -q "compose --project-name $project stop qdrant" "$operation_log"
|
||||
grep -q "compose --project-name $project start qdrant" "$operation_log"
|
||||
test "$(cat "$operation_state")" = 1
|
||||
test ! -e "$tmp/locks/$lock_name"
|
||||
test "$(cat "$foreign_lock/owner")" = foreign-owner
|
||||
test "$(cat "$foreign_lock/volume")" = foreign-volume
|
||||
if grep -q "rm -f foreign-$operation-lock" "$operation_log"; then
|
||||
echo "$operation removed a foreign operation lock" >&2
|
||||
exit 1
|
||||
fi
|
||||
start_line=$(grep -n "compose --project-name $project start qdrant" "$operation_log" | sed -n '1s/:.*//p')
|
||||
release_line=$(grep -n "rm -f $lock_name" "$operation_log" | sed -n '1s/:.*//p')
|
||||
[ "$start_line" -lt "$release_line" ] || {
|
||||
echo "$operation released its lock before qdrant reconciliation" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
assert_ambiguous_stop_reconciled backup
|
||||
assert_ambiguous_stop_reconciled restore
|
||||
|
||||
echo "qdrant backup/restore archive validation, scoped helper execution, and rollback safety passed."
|
||||
|
||||
Reference in New Issue
Block a user