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,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