Files
mtusi2026lab4/evidence/consistency-faults.json
T
zemiles c5a07dc253 ЛР 4 — БПИ2303 — Лазарев — на 4
Перенос lab3 и вложения в приватном S3 (SeaweedFS 4.50).

- POST /chats/{id}/attachments: потоковый приём PNG/JPEG в безымянный
  временный файл, SHA-256 на лету, лимиты 10 MiB / 40 Мпикс до чтения
  и декодирования, проверка MIME по содержимому, валидация filename.
- Порядок записи pending -> S3 PUT -> ready с компенсацией; janitor
  сверяет БД и bucket (dry-run, grace period, advisory lock).
- GET /attachments/{id} и /content только участникам чата, без redirect;
  attachment_ids в сообщениях с проверкой принадлежности чату.
- Отдельные S3-ключи api/janitor/admin с ограниченными правами,
  идемпотентный bootstrap bucket, служебные порты SeaweedFS закрыты.
- Ограничение параллельных S3 PUT и MALLOC_ARENA_MAX: пик RSS API
  178-189 -> 95-102 MiB; лимиты памяти и restart для SeaweedFS после OOM.
- Тесты уровня 4 (негативные, failover вложений, отказы S3/БД, память)
  и доказательства в evidence/, заполнен REPORT.md.
2026-11-07 01:44:58 +03:00

209 lines
4.2 KiB
JSON

{
"pass": true,
"steps": [
{
"step": "baseline janitor dry-run",
"t": 1794004683.9,
"report": {
"dry_run": true,
"grace_seconds": 3600,
"rows_by_status": {
"pending": 15,
"ready": 348
},
"objects_total": 349,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 2,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 96.7
}
},
{
"step": "control + victim uploaded (ready)",
"t": 1794004684.0,
"control": "d9a16769-9f6a-486f-87d5-9d72be773f4f",
"victim": "6560be97-8430-4212-b132-e8cc9f7002ec"
},
{
"step": "db-fail-after-s3-put -> compensation",
"t": 1794004687.1,
"status": 503,
"report": {
"dry_run": true,
"grace_seconds": 3600,
"rows_by_status": {
"pending": 15,
"ready": 350
},
"objects_total": 351,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 2,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 92.0
},
"leftover_pending": 0,
"leftover_objects": 0
},
{
"step": "crash-after-s3-put",
"t": 1794004687.1,
"client_saw": "Failure"
},
{
"step": "crash-after-s3-put",
"t": 1794004690.3,
"client_saw": "Failure"
},
{
"step": "crash-after-pending",
"t": 1794004699.0,
"client_saw": "Failure"
},
{
"step": "client aborted upload at 1 of 5 MiB",
"t": 1794004707.3,
"report": {
"dry_run": true,
"grace_seconds": 3600,
"rows_by_status": {
"pending": 18,
"ready": 350
},
"objects_total": 353,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 2,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 91.8
}
},
{
"step": "pending rows left by crashes",
"t": 1794004707.5,
"pending": 3
},
{
"step": "orphan injected: pending row deleted, object kept",
"t": 1794004707.6,
"row": "cfc406da-7b0a-480d-821e-4fab78251770"
},
{
"step": "missing injected: victim object deleted in S3",
"t": 1794004708.3,
"download_status": 503
},
{
"step": "janitor grace=3600 (all fresh): dry-run",
"t": 1794004714.3,
"report": {
"dry_run": true,
"grace_seconds": 3600,
"rows_by_status": {
"pending": 17,
"ready": 350
},
"objects_total": 352,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 3,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 105.7
}
},
{
"step": "janitor grace=3600 (all fresh): real run deletes nothing",
"t": 1794004714.3,
"report": {
"dry_run": false,
"grace_seconds": 3600,
"rows_by_status": {
"pending": 17,
"ready": 350
},
"objects_total": 352,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 3,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 99.5
}
},
{
"step": "after grace: dry-run",
"t": 1794004739.4,
"report": {
"dry_run": true,
"grace_seconds": 20,
"rows_by_status": {
"pending": 17,
"ready": 350
},
"objects_total": 352,
"abandoned_pending": 17,
"orphan_objects": 1,
"missing_objects": 3,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 101.9
}
},
{
"step": "after grace: real run",
"t": 1794004742.5,
"report": {
"dry_run": false,
"grace_seconds": 20,
"rows_by_status": {
"pending": 17,
"ready": 350
},
"objects_total": 348,
"abandoned_pending": 17,
"orphan_objects": 1,
"missing_objects": 3,
"deleted_objects": 18,
"deleted_rows": 17,
"errors": 0,
"duration_ms": 103.4
}
},
{
"step": "after grace: repeated run (idempotent)",
"t": 1794004746.0,
"report": {
"dry_run": false,
"grace_seconds": 20,
"rows_by_status": {
"ready": 350
},
"objects_total": 347,
"abandoned_pending": 0,
"orphan_objects": 0,
"missing_objects": 3,
"deleted_objects": 0,
"deleted_rows": 0,
"errors": 0,
"duration_ms": 99.5
}
},
{
"step": "control attachment still intact",
"t": 1794004746.1,
"sha256_ok": true,
"pending_left": 0
}
]
}