Хранить вложения в приватном S3 и сверять их с PostgreSQL.

This commit is contained in:
2026-11-06 20:13:44 +03:00
parent ec540a1a72
commit a6bb7cbb8b
34 changed files with 3285 additions and 31 deletions
+51
View File
@@ -0,0 +1,51 @@
{
"hypothesis": "A single upload is capped at 10 MiB and does not decode bitmaps above 1_000_000 pixels; ten concurrent uploads stay inside the 768 MiB container limit.",
"limits": {
"container_memory": "768MiB",
"max_upload_bytes": 10485760,
"full_decode_pixels": 1000000
},
"waves": [
{
"label": "small",
"file_bytes": 12420,
"concurrency": 10,
"successes": 10,
"errors": [],
"elapsed_seconds": 0.367,
"docker_stats_peak_bytes": {
"mtusi-api-1": 56235130,
"mtusi-api-2": 57199820
},
"vmhwm_kib_before": {
"mtusi-api-1": 74468,
"mtusi-api-2": 74984
},
"vmhwm_kib_after": {
"mtusi-api-1": 74468,
"mtusi-api-2": 74984
}
},
{
"label": "large",
"file_bytes": 3241218,
"concurrency": 10,
"successes": 10,
"errors": [],
"elapsed_seconds": 0.74,
"docker_stats_peak_bytes": {
"mtusi-api-1": 68304240,
"mtusi-api-2": 56214159
},
"vmhwm_kib_before": {
"mtusi-api-1": 74892,
"mtusi-api-2": 74776
},
"vmhwm_kib_after": {
"mtusi-api-1": 77184,
"mtusi-api-2": 76492
}
}
],
"note": "docker stats includes page cache. VmHWM is the process high-water RSS in KiB after a fresh API restart, so the two waves are comparable."
}
+100
View File
@@ -0,0 +1,100 @@
{
"hypothesis": "A full-scan reconciler with a 120s grace period removes only expired orphans and unreferenced metadata whose object is already gone.",
"method": "Inject a fresh orphan, a 2h orphan, a 2h missing unreferenced row, and a 2h missing row referenced by a message. Dry-run, apply, dry-run again.",
"dry_run": {
"mode": "dry-run",
"duration_ms": 129.367,
"db_ms": 2.036,
"list_ms": 127.228,
"list_pages": 1,
"objects_seen": 27,
"attachment_rows": 27,
"ledger_rows": 29,
"referenced_attachments": 3,
"grace_seconds": 120,
"skipped": {
"fresh_orphan": 1,
"accounted": 25,
"in_use_missing": 1
},
"actions": [
{
"op": "delete_orphan_object",
"note": "old-orphan",
"attachment_id": "b763d1e0-5694-4816-b035-3bcd748d4e48",
"age_seconds": 7200
},
{
"op": "delete_stale_metadata",
"note": "fault-stale-missing",
"attachment_id": "93a9f66b-b559-4053-8094-189d09a19864",
"age_seconds": 7200
}
],
"action_count": 2
},
"apply": {
"mode": "apply",
"duration_ms": 154.264,
"db_ms": 2.987,
"list_ms": 128.676,
"list_pages": 1,
"objects_seen": 27,
"attachment_rows": 27,
"ledger_rows": 29,
"referenced_attachments": 3,
"grace_seconds": 120,
"skipped": {
"fresh_orphan": 1,
"accounted": 25,
"in_use_missing": 1
},
"actions": [
{
"op": "delete_orphan_object",
"note": "old-orphan",
"attachment_id": "b763d1e0-5694-4816-b035-3bcd748d4e48",
"age_seconds": 7202
},
{
"op": "delete_stale_metadata",
"note": "fault-stale-missing",
"attachment_id": "93a9f66b-b559-4053-8094-189d09a19864",
"age_seconds": 7202
}
],
"action_count": 2
},
"second_dry_run": {
"mode": "dry-run",
"duration_ms": 129.352,
"db_ms": 1.791,
"list_ms": 127.518,
"list_pages": 1,
"objects_seen": 26,
"attachment_rows": 26,
"ledger_rows": 29,
"referenced_attachments": 3,
"grace_seconds": 120,
"skipped": {
"fresh_orphan": 1,
"accounted": 25,
"in_use_missing": 1,
"terminal_ledger": 2
},
"actions": [],
"action_count": 0
},
"survived": {
"fresh_orphan_object": true,
"in_use_metadata": true,
"fresh_message_attachment_sha256": "99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75",
"loose_unreferenced_attachment": "a8b23e26-ee4f-49c6-8490-16fe5a1ef9b8"
},
"limitations": [
"Walk cost is one full ListObjects plus one pass over attachment and ledger rows; this stand has one page.",
"Grace uses the ledger or metadata timestamp, not a backdated S3 LastModified, because MinIO does not let the lab rewrite LastModified.",
"In-use metadata whose bytes are gone is reported and kept; the reconciler does not invent replacement bytes.",
"A second dry-run being empty shows the repair is repeatable, not that a continuous watcher is running."
]
}
+5
View File
@@ -0,0 +1,5 @@
{
"live_while_s3_down": 200,
"ready_while_s3_down": 503,
"download_after_start": "match"
}