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

482 lines
14 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.
# Сессия, метаданные и оригинал после restart
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## before-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:41:56.334689+00:00; длительность: 0.669 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:24.516118521Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:37.447855485Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:50.41521695Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:49.925277255Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:52.124509294Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## persistence
```sh
make test-persistence ACTION_SCRIPT=scripts/restart.sh
```
Начало: 2026-10-18T20:41:57.035205+00:00; длительность: 15.362 с; exit code: 0.
````text
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## after-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:42:12.429373+00:00; длительность: 0.660 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.941585408Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:06.080394151Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.024663538Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.39677266Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.1118558Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.349056081Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.681167653Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.78951003Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## restart-audit
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe restart --before /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/before-restart.txt --after /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/after-restart.txt
```
Начало: 2026-10-18T20:42:13.123287+00:00; длительность: 0.165 с; exit code: 0.
````text
PASS: real restart db; same containers and persistent volumes
PASS: real restart redis; same containers and persistent volumes
PASS: real restart s3; same containers and persistent volumes
PASS: real restart api; same containers and persistent volumes
PASS: real restart upload-cleanup; same containers and persistent volumes
````
## 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
````
## Реализация
- [scripts/restart.sh](../../scripts/restart.sh)
- [tests/resilience.py](../../tests/resilience.py)