forked from mtusi2026/mtusi2026lab2
Добавить отчёт, черновик MR и доказательства lab2
Фиксирует результаты уровня 3/4 и трека 2: публичный smoke, black-box, persistence/expiry/outage, контейнерные проверки, SQL/rollback/EXPLAIN, 100k-эксперимент с индексами и backup/restore, чистый clone.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# check + validate + unit tests on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19
|
||||
## make check (Python 3.9.6)
|
||||
Python 3.9.6
|
||||
/usr/bin/python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
## make validate (Python 3.9 venv)
|
||||
.venv/bin/python scripts/validate_openapi.py
|
||||
/Users/ivanmuller/Desktop/oh_my_life/highload/lab2/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
|
||||
warnings.warn(
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
## go test
|
||||
? mtusi.ru/messenger-lab2/cmd/messenger [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/api 0.532s
|
||||
ok mtusi.ru/messenger-lab2/internal/auth 0.398s
|
||||
ok mtusi.ru/messenger-lab2/internal/config 0.393s
|
||||
ok mtusi.ru/messenger-lab2/internal/cursor 0.274s
|
||||
ok mtusi.ru/messenger-lab2/internal/model 0.657s
|
||||
? mtusi.ru/messenger-lab2/internal/session [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/store 0.791s
|
||||
ok mtusi.ru/messenger-lab2/internal/uuid 0.912s
|
||||
## go vet
|
||||
## go test -race
|
||||
? mtusi.ru/messenger-lab2/cmd/messenger [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/api 1.307s
|
||||
ok mtusi.ru/messenger-lab2/internal/auth 3.999s
|
||||
ok mtusi.ru/messenger-lab2/internal/config 1.451s
|
||||
ok mtusi.ru/messenger-lab2/internal/cursor 1.874s
|
||||
ok mtusi.ru/messenger-lab2/internal/model 1.591s
|
||||
? mtusi.ru/messenger-lab2/internal/session [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/store 1.726s
|
||||
ok mtusi.ru/messenger-lab2/internal/uuid 2.017s
|
||||
@@ -0,0 +1,66 @@
|
||||
# clean-clone verification
|
||||
clone_at=2026-11-30T20:53:12Z
|
||||
revision=6ea767732e2cf43dbadba6be36186c9ab1bd0a19
|
||||
branch=solution/bvt2301-melnikov
|
||||
worktree_before=0 modified/untracked paths (only ignored .env expected)
|
||||
./scripts/init-env.sh
|
||||
wrote .env with generated local synthetic credentials (mode 600); values not printed
|
||||
Container mtusi-lab2-melnikov-clean-valkey Started
|
||||
Container mtusi-lab2-melnikov-clean-postgres Started
|
||||
Container mtusi-lab2-melnikov-clean-valkey Waiting
|
||||
Container mtusi-lab2-melnikov-clean-postgres Waiting
|
||||
Container mtusi-lab2-melnikov-clean-postgres Healthy
|
||||
Container mtusi-lab2-melnikov-clean-valkey Healthy
|
||||
Container mtusi-lab2-melnikov-clean-api Starting
|
||||
Container mtusi-lab2-melnikov-clean-api Started
|
||||
ready: http://127.0.0.1:8080/health/ready
|
||||
## fresh database before tests
|
||||
migrations=2
|
||||
users=0
|
||||
chats=0
|
||||
messages=0
|
||||
## make check (Python 3.9.6)
|
||||
Python 3.9.6
|
||||
/usr/bin/python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
## go test
|
||||
? mtusi.ru/messenger-lab2/cmd/messenger [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/api 0.448s
|
||||
ok mtusi.ru/messenger-lab2/internal/auth 0.380s
|
||||
ok mtusi.ru/messenger-lab2/internal/config 0.299s
|
||||
ok mtusi.ru/messenger-lab2/internal/cursor 0.871s
|
||||
ok mtusi.ru/messenger-lab2/internal/model 0.582s
|
||||
? mtusi.ru/messenger-lab2/internal/session [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/store 1.011s
|
||||
ok mtusi.ru/messenger-lab2/internal/uuid 0.726s
|
||||
## make test (public smoke against clean stack)
|
||||
/usr/bin/python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
## student black-box suite against clean stack
|
||||
PASS health
|
||||
PASS registration/auth
|
||||
PASS registration validation
|
||||
PASS chats/membership
|
||||
PASS messages
|
||||
PASS pagination
|
||||
PASS concurrent registration
|
||||
PASS concurrent messages
|
||||
PASS logout
|
||||
PASS: lab2 student black-box suite, 78 checks
|
||||
## clean stack after tests
|
||||
migrations=2
|
||||
users=12
|
||||
chats=6
|
||||
messages=52
|
||||
chat_members,chats,messages,schema_migrations,users
|
||||
api_image_id=sha256:95cde144ae938177c164cc84a63261610f483ce676c32a0e829ba46e7c8014bc
|
||||
postgres_image=postgres:16.4-alpine3.20@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c
|
||||
valkey_image=valkey/valkey:8.0.2-alpine@sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d
|
||||
## cleanup of temporary clean-clone resources at 2026-11-30T20:53:29Z
|
||||
## clean resources remaining (expect none)
|
||||
## main stack restored after clean-clone test at 2026-11-30T20:53:31Z
|
||||
main_api=/mtusi-lab2-melnikov-api image=sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb started=2026-11-30T20:53:30.030730946Z health=starting
|
||||
users=136
|
||||
chats=55
|
||||
messages=112283
|
||||
migrations=2
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"containers": {
|
||||
"mtusi-lab2-melnikov-api": {
|
||||
"image": "mtusi-messenger-lab2-melnikov:1.0.0",
|
||||
"image_id": "sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb",
|
||||
"started_at": "2026-11-30T20:52:15.263533308Z",
|
||||
"restart_policy": "unless-stopped"
|
||||
},
|
||||
"mtusi-lab2-melnikov-postgres": {
|
||||
"image": "postgres:16.4-alpine3.20@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c",
|
||||
"image_id": "sha256:a710cb729803496a1c36335b6b519899fc3b0f332bbe16387a4d35c3e69cb5b1",
|
||||
"started_at": "2026-11-30T20:52:21.398677135Z",
|
||||
"restart_policy": "unless-stopped"
|
||||
},
|
||||
"mtusi-lab2-melnikov-valkey": {
|
||||
"image": "valkey/valkey:8.0.2-alpine@sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d",
|
||||
"image_id": "sha256:7b2072cf1b86d58fee110f4da8dc3b0e1444b22ab64f58d7f61e822e0761f866",
|
||||
"started_at": "2026-11-30T20:52:21.181106821Z",
|
||||
"restart_policy": "unless-stopped"
|
||||
}
|
||||
},
|
||||
"volumes": {
|
||||
"mtusi-lab2-melnikov-pgdata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-pgdata/_data",
|
||||
"mtusi-lab2-melnikov-valkeydata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-valkeydata/_data"
|
||||
},
|
||||
"api_user": "10001:10001",
|
||||
"api_read_only": true,
|
||||
"api_ports": [
|
||||
{
|
||||
"HostIp": "127.0.0.1",
|
||||
"HostPort": "8080"
|
||||
}
|
||||
],
|
||||
"image": {
|
||||
"reference": "mtusi-messenger-lab2-melnikov:1.0.0",
|
||||
"id": "sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb",
|
||||
"size_bytes": 19580930,
|
||||
"user": "10001:10001",
|
||||
"healthcheck": [
|
||||
"CMD",
|
||||
"/app/messenger",
|
||||
"-healthcheck"
|
||||
],
|
||||
"created": "2026-11-30T23:44:18.694178956+03:00"
|
||||
},
|
||||
"valkey": {
|
||||
"appendonly": "yes",
|
||||
"appendfsync": "everysec",
|
||||
"dir": "/data",
|
||||
"aof_enabled": true,
|
||||
"aof_last_write_status": "ok",
|
||||
"session_keys": 106
|
||||
},
|
||||
"instance_id": "26f785bd3f5188f1",
|
||||
"log_checks": {
|
||||
"token_absent": true,
|
||||
"password_absent": true,
|
||||
"message_body_absent": true,
|
||||
"authorization_header_absent": true
|
||||
},
|
||||
"graceful_shutdown": {
|
||||
"boot_seconds": 5.397,
|
||||
"shutdown_seconds": 0.073,
|
||||
"exit_code": 0
|
||||
},
|
||||
"git": {
|
||||
"tracked_files": 497,
|
||||
"env_ignored": true,
|
||||
"secret_like_tracked": []
|
||||
},
|
||||
"finished_at": "2026-11-30T20:52:32Z"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# container/infrastructure checks on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:52:22Z
|
||||
{"graceful_shutdown_seconds": 0.073, "image_id": "sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb", "image_size_bytes": 19580930, "logs_clean": true, "secret_like_tracked_files": [], "volumes": ["mtusi-lab2-melnikov-pgdata", "mtusi-lab2-melnikov-valkeydata"]}
|
||||
PASS: real containers, pinned images, named volumes, non-root read-only API, graceful shutdown, clean logs
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"checked_at": "2026-11-30T20:52:32.996878Z",
|
||||
"schema": {
|
||||
"migration_versions": "1,2",
|
||||
"constraints_present": [
|
||||
"chat_members_chat_id_fkey",
|
||||
"chat_members_pkey",
|
||||
"chat_members_position_nonnegative",
|
||||
"chat_members_user_id_fkey",
|
||||
"chats_pkey",
|
||||
"chats_title_length",
|
||||
"messages_chat_fk",
|
||||
"messages_pkey",
|
||||
"messages_sender_membership_fk",
|
||||
"messages_text_length",
|
||||
"users_display_name_length",
|
||||
"users_password_hash_present",
|
||||
"users_pkey",
|
||||
"users_username_format"
|
||||
],
|
||||
"indexes_present": [
|
||||
"chat_members_user_chat_idx",
|
||||
"chats_created_id_idx",
|
||||
"messages_chat_created_id_idx",
|
||||
"users_username_key"
|
||||
],
|
||||
"users": 134,
|
||||
"argon2id_hashes": 134,
|
||||
"duplicate_usernames": 0,
|
||||
"race_duplicates": 0
|
||||
},
|
||||
"sender_membership_fk": {
|
||||
"rejected": true,
|
||||
"messages_before": 112283,
|
||||
"messages_after": 112283
|
||||
},
|
||||
"composite_rollback": {
|
||||
"chats_left": 0,
|
||||
"api_status": 500
|
||||
},
|
||||
"migrations_idempotent": {
|
||||
"counts_before": "136,55,90,112283",
|
||||
"counts_after": "136,55,90,112283",
|
||||
"migrations_after": 2,
|
||||
"api_restarted": true
|
||||
},
|
||||
"explain": {
|
||||
"chat_id": "d64fec89-08a6-4948-acc3-4ca99ac54f5a",
|
||||
"history_messages": 60000,
|
||||
"total_messages": 112283,
|
||||
"first_page_index_rows": 50,
|
||||
"keyset_page_index_rows": 50,
|
||||
"offset_page_index_rows": 30050,
|
||||
"deep_offset": 30000,
|
||||
"index_used": "messages_chat_created_id_idx"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# SQL constraints/rollback/migrations/EXPLAIN on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:52:32Z
|
||||
{"argon2id_hashes": 134, "composite_rollback_left_chats": 0, "constraints": 14, "explain_history_messages": 60000, "indexes": 4, "keyset_rows_read": 50, "migration_counts_stable": true, "migrations": "1,2", "offset_rows_read": 30050}
|
||||
PASS: SQL constraints, FK, rollback, idempotent migrations and index-backed EXPLAIN
|
||||
@@ -0,0 +1,20 @@
|
||||
# expiry scenario on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:51:46Z
|
||||
## make test-expiry (SESSION_TTL_SECONDS=15, API-only restart)
|
||||
SESSION_TTL_SECONDS=15 ./scripts/compose.sh --env-file .env up -d --no-deps --force-recreate api
|
||||
Container mtusi-lab2-melnikov-api Recreate
|
||||
Container mtusi-lab2-melnikov-api Recreated
|
||||
Container mtusi-lab2-melnikov-api Starting
|
||||
Container mtusi-lab2-melnikov-api Started
|
||||
./scripts/wait-ready.sh
|
||||
ready: http://127.0.0.1:8080/health/ready
|
||||
/usr/bin/python3 scripts/expiry-check.py --base-url "http://localhost:8080" --restart-api
|
||||
PASS: token survived an API-only restart in 0.71s; instance 24dba34a034db04b -> 6cdb90f2247d2bb6
|
||||
{"api_restart": true, "api_restart_seconds": 0.709, "checked_at": "2026-11-30T20:52:03.596044Z", "configured_ttl_seconds": 15, "expired_status": 401, "instance_after": "6cdb90f2247d2bb6", "instance_before": "24dba34a034db04b", "observed_ttl_seconds": 15.041}
|
||||
PASS: short-TTL expiry, absolute deadline, and API-restart session survival
|
||||
./scripts/compose.sh --env-file .env up -d --no-deps --force-recreate api
|
||||
Container mtusi-lab2-melnikov-api Recreate
|
||||
Container mtusi-lab2-melnikov-api Recreated
|
||||
Container mtusi-lab2-melnikov-api Starting
|
||||
Container mtusi-lab2-melnikov-api Started
|
||||
./scripts/wait-ready.sh
|
||||
ready: http://127.0.0.1:8080/health/ready
|
||||
@@ -0,0 +1,35 @@
|
||||
LAB2 LEVEL 4 EXPLAIN EVIDENCE
|
||||
messages in history: 60000, total messages: 112283, deep offset: 30000
|
||||
|
||||
=== first page ===
|
||||
Limit (cost=0.42..8.42 rows=50 width=141) (actual time=0.021..0.041 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..9617.70 rows=60079 width=141) (actual time=0.021..0.038 rows=50 loops=1)
|
||||
Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=114
|
||||
Planning Time: 0.270 ms
|
||||
Execution Time: 0.059 ms
|
||||
|
||||
=== keyset page after offset 30000 ===
|
||||
Limit (cost=0.42..16.75 rows=50 width=141) (actual time=0.030..0.047 rows=50 loops=1)
|
||||
Buffers: shared hit=3 read=1
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..7361.33 rows=22536 width=141) (actual time=0.029..0.044 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:30.001+00'::timestamp with time zone, 'e77ba05c-13b1-46a4-ba9f-6f630e60f623'::uuid)))
|
||||
Buffers: shared hit=3 read=1
|
||||
Planning:
|
||||
Buffers: shared hit=113
|
||||
Planning Time: 0.262 ms
|
||||
Execution Time: 0.075 ms
|
||||
|
||||
=== naive OFFSET 30000 ===
|
||||
Limit (cost=4802.74..4810.74 rows=50 width=141) (actual time=11.206..11.225 rows=50 loops=1)
|
||||
Buffers: shared hit=619
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..9617.70 rows=60079 width=141) (actual time=0.020..10.570 rows=30050 loops=1)
|
||||
Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Buffers: shared hit=619
|
||||
Planning:
|
||||
Buffers: shared hit=114
|
||||
Planning Time: 0.278 ms
|
||||
Execution Time: 11.241 ms
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"probe_message_id": "96a0fcde-73d4-4599-a619-d9f3e2a51539",
|
||||
"volumes_before": {
|
||||
"mtusi-lab2-melnikov-pgdata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-pgdata/_data",
|
||||
"mtusi-lab2-melnikov-valkeydata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-valkeydata/_data"
|
||||
},
|
||||
"containers_started_before": {
|
||||
"mtusi-lab2-melnikov-postgres": "2026-11-30T20:52:09.879834802Z",
|
||||
"mtusi-lab2-melnikov-valkey": "2026-11-30T20:52:09.891634364Z"
|
||||
},
|
||||
"valkey_outage": {
|
||||
"liveness": {
|
||||
"status": 200,
|
||||
"body": {
|
||||
"status": "ok"
|
||||
}
|
||||
},
|
||||
"readiness": {
|
||||
"status": 503
|
||||
},
|
||||
"authenticated_request": {
|
||||
"path": "/api/v1/users/me",
|
||||
"status": 503,
|
||||
"code": "unavailable"
|
||||
},
|
||||
"anonymous_request": {
|
||||
"status": 401,
|
||||
"code": "unauthorized"
|
||||
},
|
||||
"login": {
|
||||
"status": 503,
|
||||
"code": "unavailable"
|
||||
},
|
||||
"registration_while_down": {
|
||||
"status": 201
|
||||
},
|
||||
"recovery_seconds": 0.302,
|
||||
"session_after_recovery": {
|
||||
"status": 200
|
||||
}
|
||||
},
|
||||
"postgres_outage": {
|
||||
"liveness": {
|
||||
"status": 200,
|
||||
"body": {
|
||||
"status": "ok"
|
||||
}
|
||||
},
|
||||
"readiness": {
|
||||
"status": 503
|
||||
},
|
||||
"authenticated_request": {
|
||||
"path": "/api/v1/users/me",
|
||||
"status": 503,
|
||||
"code": "unavailable"
|
||||
},
|
||||
"anonymous_request": {
|
||||
"status": 401,
|
||||
"code": "unauthorized"
|
||||
},
|
||||
"registration": {
|
||||
"status": 503,
|
||||
"code": "unavailable"
|
||||
},
|
||||
"recovery_seconds": 0.656,
|
||||
"session_after_recovery": {
|
||||
"status": 200
|
||||
},
|
||||
"message_after_recovery": {
|
||||
"status": 200,
|
||||
"found": true
|
||||
}
|
||||
},
|
||||
"volumes_after": {
|
||||
"mtusi-lab2-melnikov-pgdata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-pgdata/_data",
|
||||
"mtusi-lab2-melnikov-valkeydata": "/var/lib/docker/volumes/mtusi-lab2-melnikov-valkeydata/_data"
|
||||
},
|
||||
"containers_started_after": {
|
||||
"mtusi-lab2-melnikov-postgres": "2026-11-30T20:52:21.398677135Z",
|
||||
"mtusi-lab2-melnikov-valkey": "2026-11-30T20:52:21.181106821Z"
|
||||
},
|
||||
"finished_at": "2026-11-30T20:52:22.064084Z"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
# dependency outage checks on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:52:20Z
|
||||
{"postgres_recovery_seconds": 0.656, "valkey_recovery_seconds": 0.302, "volumes_kept": ["mtusi-lab2-melnikov-pgdata", "mtusi-lab2-melnikov-valkeydata"], "workers_really_restarted": true}
|
||||
PASS: bounded 503 on Valkey/PostgreSQL outage; session and data survive recovery; volumes kept
|
||||
@@ -0,0 +1,67 @@
|
||||
# final verification at 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 (2026-11-30T20:53:41Z)
|
||||
## make check
|
||||
/usr/bin/python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
## make test
|
||||
/usr/bin/python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
## make test-student
|
||||
go test -count=1 ./...
|
||||
? mtusi.ru/messenger-lab2/cmd/messenger [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/api 0.716s
|
||||
ok mtusi.ru/messenger-lab2/internal/auth 0.598s
|
||||
ok mtusi.ru/messenger-lab2/internal/config 0.244s
|
||||
ok mtusi.ru/messenger-lab2/internal/cursor 0.131s
|
||||
ok mtusi.ru/messenger-lab2/internal/model 0.588s
|
||||
? mtusi.ru/messenger-lab2/internal/session [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/store 0.474s
|
||||
ok mtusi.ru/messenger-lab2/internal/uuid 0.826s
|
||||
/usr/bin/python3 student-tests/blackbox.py --base-url "http://localhost:8080"
|
||||
PASS health
|
||||
PASS registration/auth
|
||||
PASS registration validation
|
||||
PASS chats/membership
|
||||
PASS messages
|
||||
PASS pagination
|
||||
PASS concurrent registration
|
||||
PASS concurrent messages
|
||||
PASS logout
|
||||
PASS: lab2 student black-box suite, 78 checks
|
||||
## health/readiness
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
X-Instance-Id: 768a17472e327f41
|
||||
X-Request-Id: 912efd83aa8c9d8f0d5b394368f30687
|
||||
Date: Mon, 30 Nov 2026 20:53:44 GMT
|
||||
Content-Length: 15
|
||||
|
||||
{"status":"ok"}
|
||||
## image
|
||||
id=sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb size=19580930 created=2026-11-30T23:44:18.694178956+03:00
|
||||
## data
|
||||
users=148
|
||||
chats=61
|
||||
messages=112335
|
||||
migrations=2
|
||||
## volumes
|
||||
mtusi-lab2-melnikov-pgdata
|
||||
mtusi-lab2-melnikov-valkeydata
|
||||
## git
|
||||
M REPORT.md
|
||||
?? MR.md
|
||||
?? evidence/.gitkeep
|
||||
?? evidence/check-validate-tests.txt
|
||||
?? evidence/clean-clone.txt
|
||||
?? evidence/container-checks.json
|
||||
?? evidence/container-checks.txt
|
||||
?? evidence/db-checks.json
|
||||
?? evidence/db-checks.txt
|
||||
?? evidence/expiry.txt
|
||||
?? evidence/explain-level4.txt
|
||||
?? evidence/failure-checks.json
|
||||
?? evidence/failure-checks.txt
|
||||
?? evidence/final-verification.txt
|
||||
?? evidence/persistence-restart.txt
|
||||
?? evidence/public-and-student-tests.txt
|
||||
?? evidence/track5-run.txt
|
||||
?? evidence/track5/
|
||||
@@ -0,0 +1,30 @@
|
||||
# persistence/restart on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:52:09Z
|
||||
## BEFORE
|
||||
/mtusi-lab2-melnikov-api started=2026-11-30T20:52:03.836569575Z health=healthy id=9415b8bf5d52c13e33097fa2156d3a258c1bc0b93b1ff59de3617920f8416a31
|
||||
/mtusi-lab2-melnikov-postgres started=2026-11-30T20:47:13.060213789Z health=healthy id=1c1b0711b1816f01564eadd6f17e73303f7548ccec11c8313cf69a5f6e9b0e1b
|
||||
/mtusi-lab2-melnikov-valkey started=2026-11-30T20:47:12.806011357Z health=healthy id=ed811b1f592afff7937405fb9593d2ffe963ad7ee7212efd3418ac758a4aeef8
|
||||
mtusi-lab2-melnikov-pgdata /var/lib/docker/volumes/mtusi-lab2-melnikov-pgdata/_data
|
||||
mtusi-lab2-melnikov-valkeydata /var/lib/docker/volumes/mtusi-lab2-melnikov-valkeydata/_data
|
||||
users=127
|
||||
chats=52
|
||||
messages=112280
|
||||
migrations=2
|
||||
## make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
/usr/bin/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
|
||||
/mtusi-lab2-melnikov-api started=2026-11-30T20:52:15.263533308Z health=healthy id=9415b8bf5d52c13e33097fa2156d3a258c1bc0b93b1ff59de3617920f8416a31
|
||||
/mtusi-lab2-melnikov-postgres started=2026-11-30T20:52:09.879834802Z health=healthy id=1c1b0711b1816f01564eadd6f17e73303f7548ccec11c8313cf69a5f6e9b0e1b
|
||||
/mtusi-lab2-melnikov-valkey started=2026-11-30T20:52:09.891634364Z health=healthy id=ed811b1f592afff7937405fb9593d2ffe963ad7ee7212efd3418ac758a4aeef8
|
||||
mtusi-lab2-melnikov-pgdata /var/lib/docker/volumes/mtusi-lab2-melnikov-pgdata/_data
|
||||
mtusi-lab2-melnikov-valkeydata /var/lib/docker/volumes/mtusi-lab2-melnikov-valkeydata/_data
|
||||
users=130
|
||||
chats=53
|
||||
messages=112281
|
||||
migrations=2
|
||||
## API migration logs after restart
|
||||
time=2026-11-30T20:52:03.895Z level=INFO msg="database ready" service=messenger-lab2 app_env=lab migrations=up-to-date
|
||||
time=2026-11-30T20:52:03.922Z level=INFO msg="server listening" service=messenger-lab2 app_env=lab address=[::]:8080 env=lab session_ttl_seconds=3600 graceful_shutdown_seconds=8 version=1.0.0
|
||||
time=2026-11-30T20:52:15.334Z level=INFO msg="database ready" service=messenger-lab2 app_env=lab migrations=up-to-date
|
||||
time=2026-11-30T20:52:15.362Z level=INFO msg="server listening" service=messenger-lab2 app_env=lab address=[::]:8080 env=lab session_ttl_seconds=3600 graceful_shutdown_seconds=8 version=1.0.0
|
||||
@@ -0,0 +1,26 @@
|
||||
# public smoke and student blackbox on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:51:43Z
|
||||
## make test (Python 3.9.6)
|
||||
/usr/bin/python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
## make test-student (Python 3.9.6)
|
||||
go test -count=1 ./...
|
||||
? mtusi.ru/messenger-lab2/cmd/messenger [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/api 0.414s
|
||||
ok mtusi.ru/messenger-lab2/internal/auth 0.805s
|
||||
ok mtusi.ru/messenger-lab2/internal/config 0.144s
|
||||
ok mtusi.ru/messenger-lab2/internal/cursor 0.269s
|
||||
ok mtusi.ru/messenger-lab2/internal/model 0.663s
|
||||
? mtusi.ru/messenger-lab2/internal/session [no test files]
|
||||
ok mtusi.ru/messenger-lab2/internal/store 0.796s
|
||||
ok mtusi.ru/messenger-lab2/internal/uuid 0.919s
|
||||
/usr/bin/python3 student-tests/blackbox.py --base-url "http://localhost:8080"
|
||||
PASS health
|
||||
PASS registration/auth
|
||||
PASS registration validation
|
||||
PASS chats/membership
|
||||
PASS messages
|
||||
PASS pagination
|
||||
PASS concurrent registration
|
||||
PASS concurrent messages
|
||||
PASS logout
|
||||
PASS: lab2 student black-box suite, 78 checks
|
||||
@@ -0,0 +1,3 @@
|
||||
# track 2 experiment on 6ea767732e2cf43dbadba6be36186c9ab1bd0a19 at 2026-11-30T20:52:37Z
|
||||
{"checksum_equal": true, "composite_deep_rows": 50, "counts_equal": true, "dump_bytes": 3362659, "dump_seconds": 0.272, "largest_chat_messages": 60000, "offset_rows": 30050, "restore_seconds": 0.361, "total_messages": 112283, "total_recovery_seconds": 1.616, "write_median_ms": {"chat_only": 45.997, "composite": 46.601}}
|
||||
PASS: track 2 completed; summary in evidence/track5/summary.json
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"source_counts_users_chats_members_messages_migrations": "136|55|90|112283|2",
|
||||
"restored_counts": "136|55|90|112283|2",
|
||||
"counts_equal": true,
|
||||
"per_chat_counts_equal": true,
|
||||
"history_checksum_md5": "d7788d6e93c0eca463069665fb99e6e4",
|
||||
"checksum_equal": true,
|
||||
"selected_message_id": "e77ba05c-13b1-46a4-ba9f-6f630e60f623",
|
||||
"selected_message_equal": true,
|
||||
"dump_seconds": 0.272,
|
||||
"dump_bytes": 3362659,
|
||||
"dump_sha256": "499413a6ee9afccc6daf8d542f29da5ed3bba059b4d44f08285736ae8d0fd9cd",
|
||||
"restore_seconds": 0.361,
|
||||
"total_recovery_seconds_including_container_start": 1.616,
|
||||
"restore_target": {
|
||||
"container": "mtusi-lab2-melnikov-pgrestore",
|
||||
"volume": "mtusi-lab2-melnikov-restoredata",
|
||||
"image": "postgres:16.4-alpine3.20@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c"
|
||||
},
|
||||
"cleanup": "restore container and volume removed in finally; dump file deleted"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
NAIVE INDEX (chat_id) ONLY
|
||||
|
||||
=== deep keyset page, offset 30000 ===
|
||||
Limit (cost=4289.63..4289.75 rows=50 width=141) (actual time=14.808..14.812 rows=50 loops=1)
|
||||
Buffers: shared hit=807 read=53
|
||||
-> Sort (cost=4289.63..4345.67 rows=22419 width=141) (actual time=14.807..14.809 rows=50 loops=1)
|
||||
Sort Key: created_at, id
|
||||
Sort Method: top-N heapsort Memory: 37kB
|
||||
Buffers: shared hit=807 read=53
|
||||
-> Bitmap Heap Scan on messages (cost=667.51..3544.88 rows=22419 width=141) (actual time=2.133..12.038 rows=29999 loops=1)
|
||||
Recheck Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Filter: (ROW(created_at, id) > ROW('2026-01-01 00:00:30.001+00'::timestamp with time zone, 'e77ba05c-13b1-46a4-ba9f-6f630e60f623'::uuid))
|
||||
Rows Removed by Filter: 30001
|
||||
Heap Blocks: exact=801
|
||||
Buffers: shared hit=801 read=53
|
||||
-> Bitmap Index Scan on messages_chat_only_idx (cost=0.00..661.90 rows=59948 width=0) (actual time=0.749..0.750 rows=60000 loops=1)
|
||||
Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Buffers: shared read=53
|
||||
Planning:
|
||||
Buffers: shared hit=101 read=1
|
||||
Planning Time: 0.268 ms
|
||||
Execution Time: 14.859 ms
|
||||
@@ -0,0 +1,34 @@
|
||||
COMPOSITE INDEX (chat_id, created_at, id)
|
||||
|
||||
=== first page ===
|
||||
Limit (cost=0.42..8.43 rows=50 width=141) (actual time=0.021..0.043 rows=50 loops=1)
|
||||
Buffers: shared hit=5
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..9618.01 rows=60049 width=141) (actual time=0.020..0.040 rows=50 loops=1)
|
||||
Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Buffers: shared hit=5
|
||||
Planning:
|
||||
Buffers: shared hit=114
|
||||
Planning Time: 0.268 ms
|
||||
Execution Time: 0.060 ms
|
||||
|
||||
=== deep keyset page, offset 30000 ===
|
||||
Limit (cost=0.42..16.77 rows=50 width=141) (actual time=0.018..0.036 rows=50 loops=1)
|
||||
Buffers: shared hit=4
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..7361.87 rows=22511 width=141) (actual time=0.017..0.033 rows=50 loops=1)
|
||||
Index Cond: ((chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:30.001+00'::timestamp with time zone, 'e77ba05c-13b1-46a4-ba9f-6f630e60f623'::uuid)))
|
||||
Buffers: shared hit=4
|
||||
Planning:
|
||||
Buffers: shared hit=113
|
||||
Planning Time: 0.259 ms
|
||||
Execution Time: 0.076 ms
|
||||
|
||||
=== naive OFFSET 30000 ===
|
||||
Limit (cost=4805.29..4813.30 rows=50 width=141) (actual time=11.507..11.525 rows=50 loops=1)
|
||||
Buffers: shared hit=619
|
||||
-> Index Scan using messages_chat_created_id_idx on messages (cost=0.42..9618.01 rows=60049 width=141) (actual time=0.019..10.880 rows=30050 loops=1)
|
||||
Index Cond: (chat_id = 'd64fec89-08a6-4948-acc3-4ca99ac54f5a'::uuid)
|
||||
Buffers: shared hit=619
|
||||
Planning:
|
||||
Buffers: shared hit=114
|
||||
Planning Time: 0.271 ms
|
||||
Execution Time: 11.542 ms
|
||||
@@ -0,0 +1,180 @@
|
||||
{
|
||||
"track": "track 2: query plan and recovery",
|
||||
"started_at": "2026-11-30T20:52:37.582728Z",
|
||||
"finished_at": "2026-11-30T20:52:42.265423Z",
|
||||
"duration_seconds": 4.683,
|
||||
"code_revision": "6ea767732e2cf43dbadba6be36186c9ab1bd0a19",
|
||||
"git_status": "M REPORT.md\n?? MR.md\n?? evidence/.gitkeep\n?? evidence/check-validate-tests.txt\n?? evidence/clean-clone.txt\n?? evidence/container-checks.json\n?? evidence/container-checks.txt\n?? evidence/db-checks.json\n?? evidence/db-checks.txt\n?? evidence/expiry.txt\n?? evidence/explain-level4.txt\n?? evidence/failure-checks.json\n?? evidence/failure-checks.txt\n?? evidence/final-verification.txt\n?? evidence/persistence-restart.txt\n?? evidence/public-and-student-tests.txt\n?? evidence/track5-run.txt\n?? evidence/track5/",
|
||||
"image": {
|
||||
"reference": "mtusi-messenger-lab2-melnikov:1.0.0",
|
||||
"id": "sha256:888fc6451aded79beaabfd2bc2f6578f25324facc84d3798d8b4d074272270bb",
|
||||
"created": "2026-11-30T23:44:18.694178956+03:00"
|
||||
},
|
||||
"postgres_image": "postgres:16.4-alpine3.20@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c",
|
||||
"host": {
|
||||
"docker_server_version": "27.4.0",
|
||||
"cpus": 2,
|
||||
"memory_bytes": 2054631424,
|
||||
"architecture": "aarch64"
|
||||
},
|
||||
"declared_limits": {
|
||||
"api": "1 CPU / 256 MiB",
|
||||
"postgres": "1 CPU / 512 MiB",
|
||||
"valkey": "1 CPU / 256 MiB"
|
||||
},
|
||||
"dataset": {
|
||||
"chat_sizes": [
|
||||
[
|
||||
"track5 uneven 60000",
|
||||
60000
|
||||
],
|
||||
[
|
||||
"track5 uneven 25000",
|
||||
25000
|
||||
],
|
||||
[
|
||||
"track5 uneven 10000",
|
||||
10000
|
||||
],
|
||||
[
|
||||
"track5 uneven 4000",
|
||||
4000
|
||||
],
|
||||
[
|
||||
"track5 uneven 900",
|
||||
900
|
||||
],
|
||||
[
|
||||
"track5 uneven 100",
|
||||
100
|
||||
]
|
||||
],
|
||||
"per_chat": [
|
||||
{
|
||||
"title": "track5 uneven 60000",
|
||||
"chat_id": "d64fec89-08a6-4948-acc3-4ca99ac54f5a",
|
||||
"messages": 60000
|
||||
},
|
||||
{
|
||||
"title": "track5 uneven 25000",
|
||||
"chat_id": "979398cd-2134-4956-81fd-ffcb8eb1186a",
|
||||
"messages": 25000
|
||||
},
|
||||
{
|
||||
"title": "track5 uneven 10000",
|
||||
"chat_id": "85769d60-6523-48a5-8225-9674cbb787d4",
|
||||
"messages": 10000
|
||||
},
|
||||
{
|
||||
"title": "track5 uneven 4000",
|
||||
"chat_id": "4d085ff1-c220-47a6-bc56-67af41932543",
|
||||
"messages": 4000
|
||||
},
|
||||
{
|
||||
"title": "track5 uneven 900",
|
||||
"chat_id": "8f800807-2d71-4343-92de-a8268d72494b",
|
||||
"messages": 900
|
||||
},
|
||||
{
|
||||
"title": "track5 uneven 100",
|
||||
"chat_id": "e52a1d35-df52-44e9-9649-099e269b5543",
|
||||
"messages": 100
|
||||
}
|
||||
],
|
||||
"total_messages": 112283,
|
||||
"seed_and_verify_seconds": 0.821,
|
||||
"seed_interval": {
|
||||
"started_at": "2026-11-30T20:52:37.582827Z",
|
||||
"finished_at": "2026-11-30T20:52:38.404018Z"
|
||||
},
|
||||
"sample_timestamps": "research chats sorted by (created_at,id), one-millisecond steps from 2026-01-01T00:00:00Z per chat"
|
||||
},
|
||||
"indexes": {
|
||||
"largest_chat_id": "d64fec89-08a6-4948-acc3-4ca99ac54f5a",
|
||||
"largest_chat_messages": 60000,
|
||||
"deep_offset": 30000,
|
||||
"cursor": {
|
||||
"created_at": "2026-01-01 00:00:30.001+00",
|
||||
"id": "e77ba05c-13b1-46a4-ba9f-6f630e60f623"
|
||||
},
|
||||
"composite_index": {
|
||||
"deep_page_rows_read": 50,
|
||||
"offset_page_rows_read": 30050,
|
||||
"first_page_execution_ms": 0.06,
|
||||
"deep_page_execution_ms": 0.076,
|
||||
"offset_page_execution_ms": 11.542,
|
||||
"planning_and_execution_seconds_for_three_queries": 0.117
|
||||
},
|
||||
"chat_only_index": {
|
||||
"deep_page_execution_ms": 14.859,
|
||||
"plan_uses_chat_only_index": true,
|
||||
"plan_uses_seq_scan": false,
|
||||
"plan_wall_seconds": 0.047
|
||||
},
|
||||
"interval": {
|
||||
"started_at": "2026-11-30T20:52:38.441003Z",
|
||||
"finished_at": "2026-11-30T20:52:38.931837Z",
|
||||
"seconds": 0.491
|
||||
}
|
||||
},
|
||||
"write_cost": {
|
||||
"rows_per_run": 20000,
|
||||
"runs": 3,
|
||||
"metric": "PostgreSQL EXPLAIN ANALYZE Execution Time, ms",
|
||||
"composite": {
|
||||
"runs_ms": [
|
||||
46.601,
|
||||
47.027,
|
||||
46.409
|
||||
],
|
||||
"median_ms": 46.601
|
||||
},
|
||||
"chat_only": {
|
||||
"runs_ms": [
|
||||
45.882,
|
||||
47.201,
|
||||
45.997
|
||||
],
|
||||
"median_ms": 45.997
|
||||
},
|
||||
"interval": {
|
||||
"started_at": "2026-11-30T20:52:38.931857Z",
|
||||
"finished_at": "2026-11-30T20:52:39.725932Z",
|
||||
"seconds": 0.794
|
||||
}
|
||||
},
|
||||
"backup_restore": {
|
||||
"source_counts_users_chats_members_messages_migrations": "136|55|90|112283|2",
|
||||
"restored_counts": "136|55|90|112283|2",
|
||||
"counts_equal": true,
|
||||
"per_chat_counts_equal": true,
|
||||
"history_checksum_md5": "d7788d6e93c0eca463069665fb99e6e4",
|
||||
"checksum_equal": true,
|
||||
"selected_message_id": "e77ba05c-13b1-46a4-ba9f-6f630e60f623",
|
||||
"selected_message_equal": true,
|
||||
"dump_seconds": 0.272,
|
||||
"dump_bytes": 3362659,
|
||||
"dump_sha256": "499413a6ee9afccc6daf8d542f29da5ed3bba059b4d44f08285736ae8d0fd9cd",
|
||||
"restore_seconds": 0.361,
|
||||
"total_recovery_seconds_including_container_start": 1.616,
|
||||
"restore_target": {
|
||||
"container": "mtusi-lab2-melnikov-pgrestore",
|
||||
"volume": "mtusi-lab2-melnikov-restoredata",
|
||||
"image": "postgres:16.4-alpine3.20@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c"
|
||||
},
|
||||
"cleanup": "restore container and volume removed in finally; dump file deleted",
|
||||
"interval": {
|
||||
"started_at": "2026-11-30T20:52:39.725958Z",
|
||||
"finished_at": "2026-11-30T20:52:42.208769Z",
|
||||
"seconds": 2.483
|
||||
}
|
||||
},
|
||||
"artifacts_dir_removed_after_run": "temporary directory",
|
||||
"measurement_notes": [
|
||||
"EXPLAIN elapsed values are PostgreSQL Execution Time on the local container; wall times include psql/docker exec overhead.",
|
||||
"deep page cursor is a real (created_at, id) row at the recorded OFFSET; the OFFSET comparison scans the same prefix.",
|
||||
"write cost measures INSERT plus index maintenance for 20 000 synthetic rows, 3 runs per index, median reported.",
|
||||
"backup is a single pg_dump custom-format snapshot; no WAL archiving, so RPO is the age of the last dump.",
|
||||
"restore target is a new PostgreSQL container with a new named volume, removed after reconciliation."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"rows_per_run": 20000,
|
||||
"runs": 3,
|
||||
"metric": "PostgreSQL EXPLAIN ANALYZE Execution Time, ms",
|
||||
"composite": {
|
||||
"runs_ms": [
|
||||
46.601,
|
||||
47.027,
|
||||
46.409
|
||||
],
|
||||
"median_ms": 46.601
|
||||
},
|
||||
"chat_only": {
|
||||
"runs_ms": [
|
||||
45.882,
|
||||
47.201,
|
||||
45.997
|
||||
],
|
||||
"median_ms": 45.997
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user