docs: re-capture track2-reconciler evidence on 84f8c35

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 21:31:49 +03:00
co-authored by Claude Opus 5.5
parent 84f8c353e9
commit 96d2ecca3d
7 changed files with 385 additions and 113 deletions
+150 -56
View File
@@ -1,10 +1,11 @@
# `make failure_checks`: проверки отказов с уборщиком, согласованностью БД и S3, местами загрузки и сверкой
- Дата: 2026-10-22, 16:45:12–16:53:19 UTC.
- Commit: `c1648d9` (change `track2-reconciler`: сверка bucket и БД в
процессе уборщика, колонка `lost_at`, список по префиксу у ключа
уборщика, восемь новых проверок отказов). Рабочее дерево — `c1648d9`
(вне commit — только файлы `evidence/`), образ собран из него.
- Дата: 2026-10-22, 18:04:24–18:13:30 UTC.
- Commit: `84f8c35` (правки по verify change `track2-reconciler`: строка
с ключом вне префикса вложений — чужой объект, сигнал перед каждым
вызовом хранилища, hook `set-key`, три новые проверки отказов поверх
восьми проверок сверки `c1648d9`). Рабочее дерево — `84f8c35` (вне
commit — только файлы `evidence/`), образ собран из него.
- Стенд отказов: проект `mtusi-lab4-failures` — свои PostgreSQL, Valkey
и S3 (с bootstrap, пользователи `api` и `cleaner`, у уборщика список
только с префиксом `messenger/attachments/`), порты хранилищ не
@@ -15,17 +16,20 @@
`MAX_IMAGE_PIXELS=1` в окружении, «тесный» (сроки сессии и ключа 2 с,
пул 1) и «узкий по загрузкам» (`UPLOADS_ENV`: 1 место, 1 в очереди,
ожидание 1 с, срок тела 3 с). Рабочий стенд `mtusi-lab4` в это время
запущен на том же коде (порядок обновления change в 16:32–16:34, LB —
на `127.0.0.1:8090`: 8080 хоста занят контейнером другого проекта).
запущен на образе `c1648d9` (порядок обновления change в 16:32–16:34;
`84f8c35` меняет только процесс уборщика, стенд отказов собирает его
сам; LB — на `127.0.0.1:8090`: 8080 хоста занят контейнером другого
проекта).
Docker Desktop 29.9.1, Apple M3 Pro.
- Прежние снимки этого файла: commit `5b42bd2` — 29 из 29 за 190 с;
`87c48b9` — 32 из 32 за 224 с; `5889ca2` — 32 из 32 за 228 с;
`ce1ae2c` — 37 из 37 за 255 с; `9d2ee30` — 37 из 37 за 263 с. Сейчас —
45 из 45 за 462 с: +8 проверок сверки (раздел «Сверка bucket и БД»
ниже), им нужны ожидания grace стенда (20 с) для объектов без строки и
~35 с нагрузки.
`ce1ae2c` — 37 из 37 за 255 с; `9d2ee30` — 37 из 37 за 263 с;
`c1648d9` — 45 из 45 за 462 с (+8 проверок сверки: ожидания grace
стенда, 20 с, для объектов без строки и ~35 с нагрузки). Сейчас — 48 из
48 за 524 с: +3 проверки по замечаниям verify (раздел «Сверка bucket и
БД», последние три пункта), одной из них — ожидание grace.
## Итог: код 0, 45 из 45
## Итог: код 0, 48 из 48
Вывод сборки образа (BuildKit), строки `Container …` compose, записи
alembic, вывод bootstrap S3 и журналы контейнеров стенда опущены; путь к
@@ -41,63 +45,66 @@ python3 student-tests/run_failures.py
[failure_checks] s3 bootstrap
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
[failure_checks] start api containers
[failure_checks] ready: api=http://127.0.0.1:50460 tight=http://127.0.0.1:50464 uploads=http://127.0.0.1:50468
[failure_checks] ready: api=http://127.0.0.1:54563 tight=http://127.0.0.1:54569 uploads=http://127.0.0.1:54573
[failure_checks] pytest -m fault
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- …
collecting ... collected 243 items / 198 deselected / 45 selected
collecting ... collected 246 items / 198 deselected / 48 selected
student-tests/test_failures.py::test_expired_token PASSED [ 2%]
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 4%]
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 6%]
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 8%]
student-tests/test_failures.py::test_database_stopped_and_back PASSED [ 11%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 13%]
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 15%]
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 17%]
student-tests/test_failures.py::test_readiness_without_database PASSED [ 20%]
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 22%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 24%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 26%]
student-tests/test_failures.py::test_flush_cache PASSED [ 28%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 31%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 33%]
student-tests/test_failures.py::test_valkey_back PASSED [ 35%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 37%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 40%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 42%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 44%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 46%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 48%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 51%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 53%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 55%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 57%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 60%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 62%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 64%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 66%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 68%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 71%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 73%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 75%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 77%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 80%]
student-tests/test_failures.py::test_slow_body PASSED [ 82%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 84%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 86%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 88%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 91%]
student-tests/test_failures.py::test_database_stopped_and_back PASSED [ 10%]
student-tests/test_failures.py::test_pool_exhausted PASSED [ 12%]
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 14%]
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 16%]
student-tests/test_failures.py::test_readiness_without_database PASSED [ 18%]
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 20%]
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 22%]
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 25%]
student-tests/test_failures.py::test_flush_cache PASSED [ 27%]
student-tests/test_failures.py::test_valkey_stopped PASSED [ 29%]
student-tests/test_failures.py::test_valkey_paused PASSED [ 31%]
student-tests/test_failures.py::test_valkey_back PASSED [ 33%]
student-tests/test_failures.py::test_message_failure_keeps_key_free PASSED [ 35%]
student-tests/test_failures.py::test_database_outage_keeps_key_free PASSED [ 37%]
student-tests/test_failures.py::test_key_free_after_ttl PASSED [ 39%]
student-tests/test_failures.py::test_upload_with_object_storage_stopped PASSED [ 41%]
student-tests/test_failures.py::test_rejected_uploads_leave_nothing PASSED [ 43%]
student-tests/test_failures.py::test_metadata_insert_failure PASSED [ 45%]
student-tests/test_failures.py::test_interrupted_body PASSED [ 47%]
student-tests/test_failures.py::test_ready_failure_compensated PASSED [ 50%]
student-tests/test_failures.py::test_killed_between_put_and_ready PASSED [ 52%]
student-tests/test_failures.py::test_ready_commit_outcome_unknown PASSED [ 54%]
student-tests/test_failures.py::test_upload_outlives_grace PASSED [ 56%]
student-tests/test_failures.py::test_cleaner_failure_after_object_delete PASSED [ 58%]
student-tests/test_failures.py::test_cleaner_survives_outages PASSED [ 60%]
student-tests/test_failures.py::test_object_storage_stopped PASSED [ 62%]
student-tests/test_failures.py::test_environment_does_not_change_limits PASSED [ 64%]
student-tests/test_failures.py::test_object_storage_paused PASSED [ 66%]
student-tests/test_failures.py::test_upload_slots_busy PASSED [ 68%]
student-tests/test_failures.py::test_rejections_before_queue PASSED [ 70%]
student-tests/test_failures.py::test_upload_waits_for_slot PASSED [ 72%]
student-tests/test_failures.py::test_slot_released_after_failures PASSED [ 75%]
student-tests/test_failures.py::test_slow_body PASSED [ 77%]
student-tests/test_failures.py::test_reconcile_finds_and_fixes PASSED [ 79%]
student-tests/test_failures.py::test_reconcile_keeps_fresh_used_and_unknown PASSED [ 81%]
student-tests/test_failures.py::test_reconcile_restored_original PASSED [ 83%]
student-tests/test_failures.py::test_reconcile_change_limit PASSED [ 85%]
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 87%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 89%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched PASSED [ 91%]
student-tests/test_failures.py::test_reconcile_object_storage_stopped PASSED [ 93%]
student-tests/test_failures.py::test_reconcile_interrupted_by_database PASSED [ 95%]
student-tests/test_failures.py::test_reconcile_under_load PASSED [ 97%]
student-tests/test_failures.py::test_scheduled_reconcile PASSED [100%]
================ 45 passed, 198 deselected in 462.06s (0:07:42) ================
[failure_checks] postgres log: 438 lines, crash markers 0; "too many clients" 23, "administrator command" 142
================ 48 passed, 198 deselected in 523.74s (0:08:43) ================
[failure_checks] postgres log: 458 lines, crash markers 0; "too many clients" 31, "administrator command" 143
[failure_checks] cleanup
[failure_checks] results: {'fault': 0, 'postgres': 0}
make failure_checks 2>&1 56,10s user 20,95s system 15% cpu 8:07,69 total
exit=0
```
Вся команда — 8 мин 07 с (16:45:12–16:53:19). «too many clients» и
Вся команда — 9 мин 06 с (18:04:24–18:13:30). «too many clients» и
«administrator command» — следы проверок «Предел соединений PostgreSQL
исчерпан» (`fill-connections`) и остановок PostgreSQL, признаков
аварийного перезапуска нет.
@@ -121,7 +128,7 @@ $ docker volume ls -q | wc -l
- Все контейнеры `mtusi-lab4` стартовали раньше прогона (последние — после
`make test-persistence`, `make test-failover` и остановки уборщика для
`evidence/reconcile/service.md` в 16:36–16:43; прогон — с 16:45:12), и
`evidence/reconcile/service.md` в 16:36–16:43; прогон — с 18:04:24), и
время старта после прогона то же: рабочий стенд не тронут. Список docker
volumes до и после прогона один и тот же (155 имён).
- У проекта `mtusi-lab4-failures` не осталось ни контейнеров, ни volumes.
@@ -179,6 +186,27 @@ Hook вносит расхождения с обеих сторон (`put-object
на 6 с — в журнале «Finished reconcile pass» с `apply: true`, потеря
помечена без разового прохода.
По замечаниям verify (hook `set-key` меняет только `object_key` строки):
- «Объект, на который ссылается строка, не удаляется»
(`…_keeps_referenced_objects`): у X ключ `…/attachments/x-other-<uuid>`
без объекта, Y ссылается на `<Z>/original` (строки Z нет, объект есть),
после G + 1 dry-run и `--apply` — `<X>/original`, `<Y>/original` и
`<Z>/original` — `unknown_object` и на месте, код 3; X помечено
(`missing_object` по своему ключу), Y — нет; в `finally` ключи
возвращены, объект Z удалён hook.
- «Предел не останавливает уборку зависших» (`…_limit_keeps_cleanup`):
уборщик стенда стоит, обрыв COMMIT даёт зависшую P (`age-row`), три
потери при пределе 2 — код 3, `error` о пределе, `refused: true`, ни
одной пометки, а P убрана (`removed_pending`, ни строки, ни объекта);
затем с пределом 100 помечены все три.
- «Ключ вне префикса вложений не трогается»
(`…_foreign_key_untouched`): готовой строке и зависшей загрузке `set-key`
ставит `<база>/elsewhere/<id>`; dry-run и `--apply` — обе
`unknown_object`, код 3, ни одной записи «Fixed»: строки `ready` и
`pending` на месте, готовая не помечена, их объекты под префиксом
вложений целы.
## Места загрузки и срок тела (change `upload-memory`)
«Узкий по загрузкам» API: 1 место, 1 в очереди, ожидание 1 с, срок тела
@@ -440,3 +468,69 @@ failed за 99,5 с; его вывод сохранился не полност
самих тестов и hook (`start cleaner` через `compose start` требовал
контейнер `migrate`; сравнение метаданных строк, которые изменил сам
hook), не кода: после их правки — 8 из 8 и полный прогон 45 из 45.
## Красные прогоны тестов по замечаниям verify `track2-reconciler` (2026-10-22)
Три новые проверки (tasks, группа 13) — с тестами и hook `84f8c35`, в
двух временных каталогах из `git archive` (рабочее дерево не менялось).
Рабочий стенд не трогался; после прогонов образ `mtusi-messenger:lab4`
пересобран из `84f8c35` (`docker compose build api`, контейнеры стенда не
пересоздавались), каталоги удалены.
**13.2, W2 — код приложения `a6071da`** (до правок; `git archive a6071da`,
поверх — `student-tests/` из `84f8c35`), 18:14:37–18:15:58:
```
$ python3 student-tests/run_failures.py -k "referenced_objects or limit_keeps_cleanup or foreign_key_untouched"
[failure_checks] project=mtusi-lab4-failures (working stand: mtusi-lab4)
[failure_checks] start cleaner: grace 20 s, interval 1 s, reconcile interval 0 s (0 — off)
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects PASSED [ 33%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup PASSED [ 66%]
student-tests/test_failures.py::test_reconcile_foreign_key_untouched FAILED [100%]
E AssertionError: assert {'95d43699-44...tale_pending'} == {'95d43699-44...known_object'}
E Differing items:
E {'95d43699-44d0-463d-b168-a44f99b0d141': 'missing_object'} != {'95d43699-44d0-463d-b168-a44f99b0d141': 'unknown_object'}
E {'b8dd6a9a-884a-4868-afd1-2e5dc3192d4a': 'stale_pending'} != {'b8dd6a9a-884a-4868-afd1-2e5dc3192d4a': 'unknown_object'}
student-tests/test_failures.py:2001: AssertionError
================= 1 failed, 2 passed, 243 deselected in 59.97s =================
[failure_checks] postgres log: 62 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
- `…_foreign_key_untouched` красный: прежний код считал готовую строку с
ключом `<база>/elsewhere/<id>` «метаданными без объекта» (HEAD чужого
префикса, с `--apply` — пометка), а зависшую с таким ключом —
`stale_pending` (уборка удалила бы объект по чужому ключу);
- оба теста W1 на прежнем коде зелёные: эти ветки были верны, замечание —
об их покрытии.
**13.1, W1 — `84f8c35` с двумя временными регрессиями** в
`src/core/services/attachment_reconcile.py` временного каталога:
`_recheck_orphan` без проверки ссылок (`references = []`) и `_act`,
пропускающий при отказе по пределу и зависшие загрузки (`if
state.refused: continue`), 18:16:04–18:17:05:
```
$ python3 student-tests/run_failures.py -k "referenced_objects or limit_keeps_cleanup"
student-tests/test_failures.py::test_reconcile_keeps_referenced_objects FAILED [ 50%]
student-tests/test_failures.py::test_reconcile_limit_keeps_cleanup FAILED [100%]
E Differing items:
E {'messenger/attachments/d39923b2-57c5-4e3d-8d86-0967932df378/original': 'orphan_object'} != {'messenger/attachments/d39923b2-57c5-4e3d-8d86-0967932df378/original': 'unknown_object'}
student-tests/test_failures.py:1884: AssertionError
E AssertionError: assert {} == {'50635edf-66...tale_pending'}
E Right contains 1 more item:
E {'50635edf-667c-44a7-878c-ea7298b94ef6': 'stale_pending'}
student-tests/test_failures.py:1950: AssertionError
====================== 2 failed, 244 deselected in 41.34s ======================
[failure_checks] postgres log: 59 lines, crash markers 0; "too many clients" 0, "administrator command" 0
[failure_checks] results: {'fault': 1, 'postgres': 0}
```
- без проверки ссылок объект `<Z>/original`, на который ссылается Y, стал
«объектом без метаданных» (`orphan_object`) — тест ловит удаление
используемого объекта;
- при уборке зависших под пределом P не убрана (ни одной записи
`removed_pending`) — тест ловит остановку уборки отказом по пределу.
Те же три теста на `84f8c35` без регрессий — зелёные в полном прогоне
выше (48 из 48).