Исправить замечания ревью: битый JPEG, память nginx, 502 вместо 413

JPEG проверяется через djpeg -strict: обрезанный поток с дописанным EOI
теперь даёт 415. Память nginx больше не зависит от тел файлов: загрузка
идёт потоком до API, скачивание без временных файлов, воркеров 2. API не
закрывает соединение при недочитанном теле, что давало HTML 502; nginx
сам отклоняет тела больше лимитов API. Лимит памяти API поднят до 512 MiB
под проверку CMYK-JPEG на 40 Мпикс. Добавлен стресс-тест через LB.
This commit is contained in:
alenchha
2026-11-05 13:53:08 +03:00
parent 2152d0dcad
commit a856128b45
19 changed files with 470 additions and 86 deletions
+6 -6
View File
@@ -1,11 +1,11 @@
baseline (data left by earlier tests): {"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 113, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 86, "seconds": 0.17, "stale_uploading": 0}
baseline (data left by earlier tests): {"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 366, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 203, "seconds": 0.253, "stale_uploading": 0}
== dry-run, grace=900 ==
{"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 2, "objects_scanned": 118, "orphan_objects": 0, "protected_fresh_objects": 2, "removed_rows": 0, "rows_scanned": 89, "seconds": 0.087, "stale_uploading": 1}
{"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 2, "objects_scanned": 371, "orphan_objects": 0, "protected_fresh_objects": 2, "removed_rows": 0, "rows_scanned": 206, "seconds": 0.264, "stale_uploading": 1}
ok dry-run: 1 new stale row (b), 2 old rows protected by young objects (a, h)
ok dry-run: 2 new missing objects (e, g)
ok dry-run changes nothing
== apply, grace=900 ==
{"deleted_objects": 0, "dry_run": false, "grace_seconds": 900, "marked_failed": 2, "missing_objects": 2, "objects_scanned": 118, "orphan_objects": 0, "protected_fresh_objects": 2, "removed_rows": 1, "rows_scanned": 89, "seconds": 0.1, "stale_uploading": 1}
{"deleted_objects": 0, "dry_run": false, "grace_seconds": 900, "marked_failed": 2, "missing_objects": 2, "objects_scanned": 371, "orphan_objects": 0, "protected_fresh_objects": 2, "removed_rows": 1, "rows_scanned": 206, "seconds": 0.273, "stale_uploading": 1}
ok old row whose object is young is kept (a)
ok stale row without object removed
ok fresh in-flight upload untouched
@@ -16,15 +16,15 @@ ok missing unused object marked failed
ok used attachment with object untouched
ok used attachment with lost object kept, marked failed
== apply after grace expired (grace=2 after 3s) ==
{"deleted_objects": 4, "dry_run": false, "grace_seconds": 2, "marked_failed": 1, "missing_objects": 1, "objects_scanned": 115, "orphan_objects": 1, "protected_fresh_objects": 0, "removed_rows": 3, "rows_scanned": 115, "seconds": 0.126, "stale_uploading": 3}
{"deleted_objects": 4, "dry_run": false, "grace_seconds": 2, "marked_failed": 1, "missing_objects": 1, "objects_scanned": 368, "orphan_objects": 1, "protected_fresh_objects": 0, "removed_rows": 3, "rows_scanned": 368, "seconds": 0.428, "stale_uploading": 3}
ok orphan object deleted after grace
ok expired in-flight row collected after grace
ok old row + object collected once the object is older than grace (a, h)
ok used attachment still untouched
== second apply is idempotent ==
{"deleted_objects": 0, "dry_run": false, "grace_seconds": 2, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 114, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 114, "seconds": 0.163, "stale_uploading": 0}
{"deleted_objects": 0, "dry_run": false, "grace_seconds": 2, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 367, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 367, "seconds": 0.457, "stale_uploading": 0}
ok repeat run changes nothing
== cost of a full walk, 1000 ready attachments ==
{"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 1114, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 1087, "seconds": 1.63, "stale_uploading": 0}
{"deleted_objects": 0, "dry_run": true, "grace_seconds": 900, "marked_failed": 0, "missing_objects": 0, "objects_scanned": 1367, "orphan_objects": 0, "protected_fresh_objects": 0, "removed_rows": 0, "rows_scanned": 1204, "seconds": 1.605, "stale_uploading": 0}
ok bulk walk finds nothing wrong
RESULT: 18/18 checks passed