forked from mtusi2026/mtusi2026lab4
48 lines
5.0 KiB
Plaintext
48 lines
5.0 KiB
Plaintext
# consistency: lab4: aborted upload, crash between S3 and DB, janitor, orphans, S3 outage
|
|
# date: 2026-10-22 14:21:48, commit: c942c61 + uncommitted changes
|
|
# command: python.exe student-tests/test_consistency.py
|
|
# exit code: 0, 133.0 s
|
|
|
|
declared 9 000 000 bytes, sent 211817, closed the connection
|
|
declared 9 000 000 bytes, sent 3111817, closed the connection
|
|
rows in attachments: 448 -> 448; objects in bucket: 444 -> 444
|
|
temporary upload files in api containers: {'343119df2488': 0, 'd590adc21943': 0} (removed when the request ends)
|
|
api containers have no volumes: the original is never stored locally
|
|
PASS: an interrupted upload leaves no row, no object and no local file
|
|
crash after S3 PUT: row 9aa0bc8a state=uploading, object originals/8ae03455b55a4f798b7bc6248b450ef9 exists in S3
|
|
the half-written attachment is invisible: GET -> 404, attach to a message -> 404
|
|
janitor with default grace (3600 s) right away: {"dry_run": false, "grace_seconds": 3600, "stale_uploads": 0, "stale_uploads_deleted": 0, "objects_scanned": 446, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.133} -> fresh row and object are kept (the upload might still be running)
|
|
row made 2 h old; janitor --dry-run: {"dry_run": true, "grace_seconds": 3600, "stale_uploads": 1, "stale_uploads_deleted": 0, "objects_scanned": 446, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.184} -> nothing deleted
|
|
janitor: {"dry_run": false, "grace_seconds": 3600, "stale_uploads": 1, "stale_uploads_deleted": 1, "objects_scanned": 445, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.132} -> row and object deleted
|
|
janitor again: {"dry_run": false, "grace_seconds": 3600, "stale_uploads": 0, "stale_uploads_deleted": 0, "objects_scanned": 445, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.179} -> idempotent
|
|
the ready attachment of the same chat is untouched
|
|
PASS: S3 written but DB not committed -> invisible, reclaimed by janitor only after the grace period
|
|
object originals/101748e3a911439a9c1e11e768c99822 put into the bucket without a row in PostgreSQL
|
|
janitor --grace-seconds 3 immediately: {"dry_run": false, "grace_seconds": 3, "stale_uploads": 0, "stale_uploads_deleted": 0, "objects_scanned": 447, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.191} -> fresh object kept
|
|
after 4 s, --dry-run: {"dry_run": true, "grace_seconds": 3, "stale_uploads": 0, "stale_uploads_deleted": 0, "objects_scanned": 447, "orphan_objects": 1, "orphan_objects_deleted": 0, "missing_objects": 4, "seconds": 0.188} -> reported, kept
|
|
janitor: {"dry_run": false, "grace_seconds": 3, "stale_uploads": 0, "stale_uploads_deleted": 0, "objects_scanned": 447, "orphan_objects": 1, "orphan_objects_deleted": 1, "missing_objects": 4, "seconds": 0.1} -> orphan deleted
|
|
ready attachments older than the grace period are untouched (they have rows)
|
|
object of a ready attachment deleted behind the API's back: janitor reports missing_objects=5 and keeps the row; download -> 503 (not 500)
|
|
PASS: orphans are found and deleted only after the grace period; missing objects are reported
|
|
--- S3 stopped (connection refused / name not resolved): docker compose stop s3
|
|
upload -> 503 unavailable in 19453 ms, no storage details in the body
|
|
download of an existing file -> 503
|
|
metadata, messages (also with an already stored attachment) and /health/ready keep working: S3 is needed only for file bytes
|
|
uploading rows of this chat: before 0, after the failed upload 1 (kept as a pointer for janitor if the rollback could not reach S3); not visible through the API
|
|
docker compose start s3
|
|
after S3 recovery the old file downloads byte for byte
|
|
new upload -> 201
|
|
janitor after grace period: {"dry_run": false, "grace_seconds": 3600, "stale_uploads": 1, "stale_uploads_deleted": 1, "objects_scanned": 448, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 5, "seconds": 0.191}
|
|
PASS: S3 stopped (connection refused / name not resolved) -> 503 for file operations only, no visible half-uploads, everything cleaned up
|
|
--- S3 frozen (no answer, timeouts): docker compose pause s3
|
|
upload -> 503 unavailable in 14891 ms, no storage details in the body
|
|
download of an existing file -> 503
|
|
metadata, messages (also with an already stored attachment) and /health/ready keep working: S3 is needed only for file bytes
|
|
uploading rows of this chat: before 0, after the failed upload 1 (kept as a pointer for janitor if the rollback could not reach S3); not visible through the API
|
|
docker compose unpause s3
|
|
after S3 recovery the old file downloads byte for byte
|
|
new upload -> 201
|
|
janitor after grace period: {"dry_run": false, "grace_seconds": 3600, "stale_uploads": 1, "stale_uploads_deleted": 1, "objects_scanned": 450, "orphan_objects": 0, "orphan_objects_deleted": 0, "missing_objects": 5, "seconds": 0.115}
|
|
PASS: S3 frozen (no answer, timeouts) -> 503 for file operations only, no visible half-uploads, everything cleaned up
|
|
5 passed, 0 failed
|