200 lines
7.1 KiB
Markdown
200 lines
7.1 KiB
Markdown
# 4: поочерёдная замена под нагрузкой и миграции
|
|
|
|
## Что проверяется
|
|
|
|
Обе API заменяются последовательно: drain, завершение запросов, SIGTERM, создание новой API, ожидание readiness/DNS. Survivor не заменяется. Одно явное применение миграций на операцию; поддерживаются только обратно совместимые миграции.
|
|
|
|
Статус выполнения проверок: **PASS**. Для исследования PASS означает успешную проверку данных и правил анализа; решение гипотезы указано отдельно и может быть неопределённым.
|
|
|
|
Запуск: `lab3-report-04`. Команды выполнены из корня проекта в WSL; время и версии указаны в manifest.
|
|
|
|
## Команды и фактический вывод
|
|
|
|
### rolling
|
|
|
|
Проверка приложения.
|
|
|
|
```sh
|
|
python3 scripts/check_rolling.py
|
|
```
|
|
|
|
Начало UTC: `2026-10-10T16:24:40.188049+00:00`; конец UTC: `2026-10-10T16:25:08.619608+00:00`; exit code: **0**.
|
|
|
|
Вывод команды:
|
|
|
|
```text
|
|
Container highload-lab3-migrate-run-8120f6a79ab5 Creating
|
|
Container highload-lab3-migrate-run-8120f6a79ab5 Created
|
|
2026/10/10 16:24:49 migration up complete
|
|
Container highload-lab3-api-13 Running
|
|
Container highload-lab3-api-14 Creating
|
|
Container highload-lab3-api-14 Created
|
|
Container highload-lab3-api-14 Starting
|
|
Container highload-lab3-api-14 Started
|
|
Container highload-lab3-api-14 Waiting
|
|
Container highload-lab3-api-13 Waiting
|
|
Container highload-lab3-api-14 Healthy
|
|
Container highload-lab3-api-13 Healthy
|
|
{"old_instance": "04f3baa4775a", "new_instance": "2fcedadb893e", "survivor_instance": "4864ca4d784f", "replacement_seconds": 7.733, "graceful_shutdown": true}
|
|
Container highload-lab3-api-14 Running
|
|
Container highload-lab3-api-15 Creating
|
|
Container highload-lab3-api-15 Created
|
|
Container highload-lab3-api-15 Starting
|
|
Container highload-lab3-api-15 Started
|
|
Container highload-lab3-api-15 Waiting
|
|
Container highload-lab3-api-14 Waiting
|
|
Container highload-lab3-api-15 Healthy
|
|
Container highload-lab3-api-14 Healthy
|
|
{"old_instance": "4864ca4d784f", "new_instance": "e057f7d85be3", "survivor_instance": "2fcedadb893e", "replacement_seconds": 7.964, "graceful_shutdown": true}
|
|
{
|
|
"elapsed_seconds": 21.747,
|
|
"concurrency": 4,
|
|
"successful_writes": 1474,
|
|
"successful_reads": 1566,
|
|
"errors": 0,
|
|
"successful_rps": 139.788,
|
|
"replacements": [
|
|
{
|
|
"old_instance": "04f3baa4775a",
|
|
"new_instance": "2fcedadb893e",
|
|
"survivor_instance": "4864ca4d784f",
|
|
"replacement_seconds": 7.733,
|
|
"graceful_shutdown": true
|
|
},
|
|
{
|
|
"old_instance": "4864ca4d784f",
|
|
"new_instance": "e057f7d85be3",
|
|
"survivor_instance": "2fcedadb893e",
|
|
"replacement_seconds": 7.964,
|
|
"graceful_shutdown": true
|
|
}
|
|
],
|
|
"confirmed_messages_preserved": true,
|
|
"session_preserved": true,
|
|
"workload": "two writers, two readers, 20ms pause per worker; not a capacity benchmark"
|
|
}
|
|
PASS: sequential replacement under load; all confirmed messages and sessions preserved
|
|
```
|
|
|
|
Полный сохранённый вывод: [evidence/criteria/runs/lab3-report-04/rolling.txt](runs/lab3-report-04/rolling.txt).
|
|
|
|
- [evidence/criteria/runs/lab3-report-04/rolling.json](runs/lab3-report-04/rolling.json)
|
|
|
|
### final-inventory
|
|
|
|
Проверка приложения.
|
|
|
|
```sh
|
|
python3 scripts/generate_evidence.py --inspect
|
|
```
|
|
|
|
Начало UTC: `2026-10-10T16:26:30.526830+00:00`; конец UTC: `2026-10-10T16:26:32.003643+00:00`; exit code: **0**.
|
|
|
|
Фрагмент вывода; полный журнал доступен по ссылке ниже.
|
|
|
|
```text
|
|
{
|
|
"containers": [
|
|
{
|
|
"service": "api",
|
|
"instance": "2fcedadb893e",
|
|
"state": "running",
|
|
"exit_code": 0,
|
|
"health": "healthy",
|
|
"cpu": 500000000,
|
|
"memory": 134217728,
|
|
"ports": {},
|
|
"networks": {
|
|
"highload-lab3_data": {
|
|
"address": "172.25.0.4"
|
|
},
|
|
"highload-lab3_proxy": {
|
|
"address": "172.24.0.3"
|
|
}
|
|
},
|
|
"image": "sha256:d4ba271b288da51c1190a01305f64639308bbc420108e0b79561235c049a3b4a",
|
|
"started": "2026-10-10T16:26:23.932036229Z",
|
|
"container_id": "2fcedadb893e9548fb08a124704944a0fa885fd24e3d22366704a5ea3d8583fc",
|
|
"gomaxprocs": "1"
|
|
},
|
|
{
|
|
"service": "api",
|
|
"instance": "e057f7d85be3",
|
|
"state": "running",
|
|
"exit_code": 0,
|
|
"health": "healthy",
|
|
"cpu": 500000000,
|
|
"memory": 134217728,
|
|
"ports": {},
|
|
"networks": {
|
|
"highload-lab3_data": {
|
|
"address": "172.25.0.5"
|
|
},
|
|
"highload-lab3_proxy": {
|
|
"address": "172.24.0.2"
|
|
}
|
|
},
|
|
"image": "sha256:d4ba271b288da51c1190a01305f64639308bbc420108e0b79561235c049a3b4a",
|
|
"started": "2026-10-10T16:25:19.574614979Z",
|
|
"container_id": "e057f7d85be33bb7836b462bdec3ef9115b2dae2a1c25107edfe27b3ee268a2f",
|
|
"gomaxprocs": "1"
|
|
},
|
|
{
|
|
"service": "db",
|
|
"instance": "edfcf3091ee4",
|
|
"state": "running",
|
|
"exit_code": 0,
|
|
"health": "healthy",
|
|
"cpu": 1000000000,
|
|
"memory": 536870912,
|
|
"ports": {},
|
|
"networks": {
|
|
"highload-lab3_data": {
|
|
"address": "172.25.0.2"
|
|
}
|
|
},
|
|
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
|
|
"started": "2026-10-10T16:25:14.885950406Z",
|
|
"container_id": "edfcf3091ee410c68a4d6845fee0aaed1477744abba90d7b6de8dffbfe51f05c"
|
|
},
|
|
{
|
|
"service": "frontend",
|
|
"instance": "ceb091ff4cee",
|
|
"state": "running",
|
|
"exit_code": 0,
|
|
"health": "healthy",
|
|
... [пропущенные строки — в полном журнале] ...
|
|
"path": "/health/ready",
|
|
"status": 200,
|
|
"instance": "e057f7d85be3"
|
|
}
|
|
],
|
|
"migration_version_dirty": "3|f",
|
|
"git_ignored": [
|
|
".env",
|
|
".memory/"
|
|
],
|
|
"hook_scope": {
|
|
"restart.sh": {
|
|
"sha256": "0bdb05ec336f4e175ab2a76f172fcab06512003f70962adcd3e4c64567da1c43"
|
|
},
|
|
"stop-one.sh": {
|
|
"sha256": "6eda7ff0eaaf521a2510e3b4ea2675ec7cd44851aeedf7300ca099ade9fa46f8"
|
|
}
|
|
}
|
|
}
|
|
PASS: actual containers and HAProxy addresses agree; migration 3 clean; storage/API private; secrets ignored
|
|
```
|
|
|
|
Полный сохранённый вывод: [evidence/criteria/runs/lab3-report-04/final-inventory.txt](runs/lab3-report-04/final-inventory.txt).
|
|
|
|
|
|
## Реализация и дополнительные доказательства
|
|
|
|
- [scripts/rolling_update.py](../../scripts/rolling_update.py)
|
|
- [scripts/check_rolling.py](../../scripts/check_rolling.py)
|
|
- [compose.yml](../../compose.yml)
|
|
- [src/backend/repositories/database.go](../../src/backend/repositories/database.go)
|
|
- [src/backend/repositories/migrations/000003_message_idempotency.up.sql](../../src/backend/repositories/migrations/000003_message_idempotency.up.sql)
|
|
- [evidence/criteria/runs/lab3-report-04/manifest.json](runs/lab3-report-04/manifest.json)
|