Evidence taken on ff1a83b. The report covers level 3; levels 4 and 5 are
closed by the following changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.6 KiB
Ревизия a1d4c7e90b23: проба, откат на прежний образ и возврат
- Дата: 2026-10-31, 03:59–04:02 UTC
- Commit:
ff1a83b, рабочее дерево без правок кода (на момент прогона добавлены только файлыevidence/) - Стенд: проект compose
mtusi-lab5; проба — на временной базе в контейнереpostgres(DATABASE__NAMEв окруженииuv run alembic, в концеDROP DATABASE), строки синтетические - Спеки:
db-migrations,data-storage - Вывод сокращён: убраны строки
DETAILс синтетическими значениями, предупреждениеSAWarningприalembic check, ID образов, строкиdocker compose ps; итогmake reconcileприведён полями из записи «Finished reconcile pass»
Проба ревизии на временной базе
С нуля, alembic check, повтор, откат, снова upgrade; строки pending и ready прежней ревизии — статус прежний, оба CHECK NOT VALID; нарушения ограничений; транзакция держит attachments дольше 2 с (ACCESS SHARE против ACCESS EXCLUSIVE миграции) — миграция падает без изменений, повтор проходит.
CREATE DATABASE
alembic upgrade head: exit 0
a1d4c7e90b23 (head)
alembic current: exit 0
No new upgrade operations detected.
alembic check: exit 0
alembic upgrade head: exit 0
alembic downgrade -1: exit 0
5c3e1f0a9b7d
alembic current: exit 0
alembic upgrade head: exit 0
a1d4c7e90b23 (head)
alembic current: exit 0
--- rows of the old revision, then upgrade
alembic downgrade -1: exit 0
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 2
alembic upgrade head: exit 0
status of old rows: id | status | staging_key IS NULL | error_code IS NULL
33333333-3333-4333-8333-333333333331|pending|t|t
33333333-3333-4333-8333-333333333332|ready|t|t
convalidated:
ck_attachments_error_code_failed|f
ck_attachments_status|f
--- constraints
INSERT 0 1
second job of the version:
ERROR: duplicate key value violates unique constraint "uq_attachment_jobs_attachment_id_pipeline_version"
INSERT 0 1
second variant of the name:
ERROR: duplicate key value violates unique constraint "pk_attachment_variants"
error_code on not failed:
ERROR: new row for relation "attachments" violates check constraint "ck_attachments_error_code_failed"
failed without code:
ERROR: new row for relation "attachments" violates check constraint "ck_attachments_error_code_failed"
delete attachment with job:
ERROR: update or delete on table "attachments" violates foreign key constraint "fk_attachment_jobs_attachment_id_attachments" on table "attachment_jobs"
--- lock_timeout: a transaction holds attachments longer than 2 s
alembic downgrade -1: exit 0
upgrade under lock: exit 1 in 2 s; reason: canceling statement due to lock timeout LockNotAvailable
current after failure:
5c3e1f0a9b7d
alembic current: exit 0
alembic upgrade head: exit 0
a1d4c7e90b23 (head)
alembic current: exit 0
DROP DATABASE
cleanup done
Откат на образ cc33a03 и возврат
Команды по Migration Plan design: docker compose stop worker cleaner, make rolling_update COMMIT=cc33a03 MIGRATE=0, затем make rolling_update, docker compose up -d --no-deps cleaner worker. Схема при откате не меняется. Загрузка 202 — до отката, на текущем коде при остановленном worker: её строка остаётся queued, и прежний образ читает её с 500 — названное ограничение (REPORT.md, «Ограничения»).
--- current code, worker and cleaner stopped
$ docker compose stop worker cleaner: exit 0, 0 s
upload on current code: 202 queued 9b6ed70e-8b58-4209-859a-befd9a39d55b
--- rollback: make rolling_update COMMIT=cc33a03 MIGRATE=0
$ make rolling_update COMMIT=cc33a03 MIGRATE=0: exit 0, 9 s
mtusi-lab5-api-3 mtusi-messenger:lab5 Up 6 seconds (healthy)
mtusi-lab5-api-4 mtusi-messenger:lab5 Up 3 seconds (healthy)
--- previous image on the new schema
send message: 201
history: 200
upload on the previous image: 201 ready c36d8107-8960-48bf-8d92-fbfa03f2b924
read of the row in the new status (named limitation): 500 internal_error
read of the previous image's own row: 200 ready
--- forward: make rolling_update, up cleaner worker
$ make rolling_update: exit 0, 10 s
$ docker compose up -d --no-deps cleaner worker: exit 0, 0 s
mtusi-lab5-api-5 mtusi-messenger:lab5 Up 7 seconds (healthy)
mtusi-lab5-api-6 mtusi-messenger:lab5 Up 3 seconds (healthy)
$ make lb_stats: exit 0, 0 s
api-2 172.31.0.6:8080 UP L7OK 0 10 0 0 0 0
api-3 172.31.0.7:8080 UP L7OK 0 3 0 0 0 0
--- current code again
attachment queued before rollback: ready variants 1
new upload: ready variants 1
attachment of the previous image: 200 ready variants [] error_code None
its original: 200 same bytes: True
its thumbnail: 404 not_found
--- make reconcile (dry-run)
make reconcile: exit 0
found: {}, fixed: {}, listed_objects: 2321, checked_rows: 1159
old attachment named by reconcile: False
После пробы стенд пересобран make down + make run_docker: api-1, api-2, все сервисы на одном образе. sha256 файлов src, migrations и alembic.ini в образе совпали с git show HEAD:<файл> (120 файлов).