forked from mtusi2026/mtusi2026lab4
86 lines
2.3 KiB
Plaintext
86 lines
2.3 KiB
Plaintext
2026-11-20T04:14:17+03:00
|
|
failure between S3 write and database commit: an object must not stay unaccounted
|
|
|
|
$ scripts/reconcile.sh # baseline
|
|
{
|
|
"prefix": "chats/",
|
|
"grace_seconds": 3600,
|
|
"dry_run": true,
|
|
"scanned_objects": 15,
|
|
"scanned_rows": 16,
|
|
"truncated": false,
|
|
"orphans": [],
|
|
"missing": [
|
|
{
|
|
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
|
"created_at": "2026-11-20T01:11:14Z"
|
|
}
|
|
],
|
|
"deleted_objects": 0,
|
|
"delete_failures": 0,
|
|
"duration_ms": 8
|
|
}
|
|
|
|
$ podman exec -i postgres psql < scripts/sql/inject-db-failure.sql
|
|
CREATE FUNCTION
|
|
NOTICE: trigger "inject_attachment_insert_failure" for relation "attachments" does not exist, skipping
|
|
DROP TRIGGER
|
|
CREATE TRIGGER
|
|
|
|
$ scripts/upload-once.py --expect 503 # insert fails after a successful S3 PUT
|
|
status=503
|
|
|
|
$ scripts/reconcile.sh # same object count: compensating DELETE removed the object
|
|
{
|
|
"prefix": "chats/",
|
|
"grace_seconds": 3600,
|
|
"dry_run": true,
|
|
"scanned_objects": 15,
|
|
"scanned_rows": 16,
|
|
"truncated": false,
|
|
"orphans": [],
|
|
"missing": [
|
|
{
|
|
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
|
"created_at": "2026-11-20T01:11:14Z"
|
|
}
|
|
],
|
|
"deleted_objects": 0,
|
|
"delete_failures": 0,
|
|
"duration_ms": 7
|
|
}
|
|
|
|
$ podman exec -i postgres psql < scripts/sql/reset-db-failure.sql
|
|
DROP TRIGGER
|
|
DROP FUNCTION
|
|
|
|
$ scripts/upload-once.py --expect 201 # service healthy again
|
|
status=201
|
|
attachment=a6844b91-5b7b-4694-93fc-87d808b687fb size=653
|
|
|
|
$ scripts/reconcile.sh # one more accounted object
|
|
{
|
|
"prefix": "chats/",
|
|
"grace_seconds": 3600,
|
|
"dry_run": true,
|
|
"scanned_objects": 16,
|
|
"scanned_rows": 17,
|
|
"truncated": false,
|
|
"orphans": [],
|
|
"missing": [
|
|
{
|
|
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
|
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
|
"created_at": "2026-11-20T01:11:14Z"
|
|
}
|
|
],
|
|
"deleted_objects": 0,
|
|
"delete_failures": 0,
|
|
"duration_ms": 7
|
|
}
|