Files
mtusi2026lab4/evidence/criteria/replica-failover.md
T
2026-10-19 00:20:43 +03:00

129 lines
4.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Оригинал после остановки обслужившей API
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## proxy-failures
```sh
make test-grade3-failures
```
Начало: 2026-10-18T20:41:17.113921+00:00; длительность: 42.575 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080" --failures
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
PASS: stop the uploading replica, download from the other (both replicas)
PASS: S3 unavailable/recovery, private bucket
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## public-failover
```sh
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
```
Начало: 2026-10-18T20:42:54.991730+00:00; длительность: 18.692 с; exit code: 0.
````text
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 2, "first_recovery_seconds": 1.793}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## restore
```sh
make app-start
```
Начало: 2026-10-18T20:43:17.143841+00:00; длительность: 9.220 с; exit code: 0.
````text
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --no-build --wait
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-frontend-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Starting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Started
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-redis-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Healthy
Container highload-lab4-redis-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
````
## Реализация
- [scripts/check_grade3.py](../../scripts/check_grade3.py)
- [scripts/check_direct_upload.py](../../scripts/check_direct_upload.py)
- [scripts/stop-one.sh](../../scripts/stop-one.sh)