forked from mtusi2026/mtusi2026lab3
No failover run ever lost an answer, so the retry of an unconfirmed write was only covered in process. make retry-check holds the chat row with SELECT ... FOR UPDATE for 1.5 s (below lock_timeout), sends a message with a 0.5 s client timeout, finds the replica whose request waits on the lock in pg_stat_activity and then retries with the same key and text through the LB, once with that replica alive and once after docker kill. It checks the 201, a single copy with the id of the retry answer and, for the live replica, the 201 it logged without a client; created_at tells which attempt wrote the message. CI runs it. failover-each and rolling-update now record the database size and a docker stats snapshot in the background of the action, rolling-update names the tag and id of every image it replaces, and scaling.py writes started and the compose-up log marks in UTC with Z; the track README states that the recorded rows are host time (MSK) and what host-others.csv covers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
2.7 KiB
2.7 KiB
1. Платформа: остановка, готовность, журнал
- 1.1
RequestPipeline: отмена задачи →request.cancelled,503 unavailableв общем формате, если ответ не начат, затем отмена пробрасывается - 1.2
test_drain.py: прерванный при остановке запрос —503,application/json,error.code = unavailable,request_id=X-Request-Id, непустойX-Instance-Id - 1.3 Порт
Readiness, адаптерDatabaseReadinessс флагомDRAININGвshared/infrastructure/readiness.py, сборка вPlatformProvider, маршрут/health/readyчерез порт; тест состава модулей ядра - 1.4
gunicorn_conf.py: флаг из инфраструктуры, событиеservice.drainingчерезStructlogLogger;failover-evidence.shищет его в логе - 1.5
openspec/config.yaml: карта модулей (readinessза портом) - 1.6 Проверка группы:
make lint,make student-test,make check
2. Стенд и CI
- 2.1
make upждёт все реплики в LB (scripts/lb-wait.sh) - 2.2 CI: non-root по числовому uid
docker top -eo pid,uid,comm; шагmake retry-check - 2.3 Проверка группы:
make upи сразуmake test-failover ACTION_SCRIPT=scripts/stop-one.sh; проверка non-root на стенде и на контейнере от root
3. Обвязка доказательств
- 3.1
probe.py retryиmake retry-check: потерянный ответ на живой и на убитой реплике →evidence/retry.json - 3.2
scripts/stand-usage.shв действияхfailover-eachиrolling-update; тег и ID образа вrolling-update.sh - 3.3
scaling.py:startedи меткиcompose-up-failed.logв UTC;evidence/track1/README.md— время прежних строк (MSK) - 3.4 Проверка группы:
make lint,make check,sh -nскриптов,make retry-checkна стенде
4. Доказательства и отчёт
- 4.1 Уровни «3» и «4» заново на итоговом коде:
checks.txt(сgit diff --stat upstream/mainконтракта и тестов),student-tests.txt, стенд,make retry-check,make level4, чистый clone - 4.2
REPORT.mdиevidence/README.mdпо новым доказательствам; числа отчёта сверены скриптом сevidence/ - 4.3 Проверка группы:
make check,make lint,make student-test,openspec validate --all --strict