forked from mtusi2026/mtusi2026lab4
feat: restricted S3 credentials, orphan reconciler, upload limits (grade 4)
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
2026-11-20T03:51:29+03:00
|
||||
2026-11-20T04:20:26+03:00
|
||||
make check
|
||||
|
||||
python3 scripts/check_contract.py
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
2026-11-20T04:14:17+03:00
|
||||
failure between S3 write and database commit: an object must not stay unaccounted
|
||||
|
||||
$ scripts/reconcile.sh # baseline
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 3600,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 15,
|
||||
"scanned_rows": 16,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [
|
||||
{
|
||||
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
||||
"created_at": "2026-11-20T01:11:14Z"
|
||||
}
|
||||
],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 8
|
||||
}
|
||||
|
||||
$ podman exec -i postgres psql < scripts/sql/inject-db-failure.sql
|
||||
CREATE FUNCTION
|
||||
NOTICE: trigger "inject_attachment_insert_failure" for relation "attachments" does not exist, skipping
|
||||
DROP TRIGGER
|
||||
CREATE TRIGGER
|
||||
|
||||
$ scripts/upload-once.py --expect 503 # insert fails after a successful S3 PUT
|
||||
status=503
|
||||
|
||||
$ scripts/reconcile.sh # same object count: compensating DELETE removed the object
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 3600,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 15,
|
||||
"scanned_rows": 16,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [
|
||||
{
|
||||
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
||||
"created_at": "2026-11-20T01:11:14Z"
|
||||
}
|
||||
],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 7
|
||||
}
|
||||
|
||||
$ podman exec -i postgres psql < scripts/sql/reset-db-failure.sql
|
||||
DROP TRIGGER
|
||||
DROP FUNCTION
|
||||
|
||||
$ scripts/upload-once.py --expect 201 # service healthy again
|
||||
status=201
|
||||
attachment=a6844b91-5b7b-4694-93fc-87d808b687fb size=653
|
||||
|
||||
$ scripts/reconcile.sh # one more accounted object
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 3600,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 16,
|
||||
"scanned_rows": 17,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [
|
||||
{
|
||||
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
||||
"created_at": "2026-11-20T01:11:14Z"
|
||||
}
|
||||
],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 7
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
2026-11-20T04:17:09+03:00
|
||||
separate restricted S3 credentials for the API and idempotent bucket bootstrap
|
||||
|
||||
$ podman-compose run --rm s3-init (first run)
|
||||
bucket ready: messenger-attachments
|
||||
policy ready: messenger-app
|
||||
application credentials ready
|
||||
policy attached to application credentials
|
||||
|
||||
$ podman-compose run --rm s3-init (second run: idempotent)
|
||||
bucket ready: messenger-attachments
|
||||
policy ready: messenger-app
|
||||
application credentials ready
|
||||
policy attached to application credentials
|
||||
|
||||
secret files mounted into api vs s3 (hashes differ)
|
||||
api_1 app secret sha256: 02b5014e8a0f03ac52a0a32d19abe13cd0e64ad9a9c61f178e3eede9989c82ce
|
||||
s3 root secret sha256: 970780881d80d85eb3f084c147c71e390fa563e0e022fa75cd8170d5a607cacc
|
||||
|
||||
secrets per role
|
||||
messenger-lab4_api_1: cache_url database_url s3_access_key_id s3_secret_access_key
|
||||
messenger-lab4_s3_1: s3_root_access_key s3_root_secret_key
|
||||
|
||||
$ scripts/s3tool.sh remove-bucket messenger-attachments (must be denied)
|
||||
s3tool failed: dependency unavailable: Access Denied
|
||||
@@ -1,7 +1,7 @@
|
||||
2026-11-20T03:53:34+03:00
|
||||
2026-11-20T04:18:05+03:00
|
||||
|
||||
users | chats | messages | attachments | links | db_size
|
||||
-------+-------+----------+-------------+-------+---------
|
||||
40 | 11 | 289 | 8 | 2 | 8542 kB
|
||||
58 | 17 | 303 | 30 | 2 | 8534 kB
|
||||
(1 row)
|
||||
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
2026-11-20T03:53:33+03:00
|
||||
2026-11-20T04:18:05+03:00
|
||||
|
||||
Linux archlinux 7.3.5-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 17 Nov 2026 22:28:33 +0000 x86_64 GNU/Linux
|
||||
12
|
||||
total used free shared buff/cache available
|
||||
Mem: 15Gi 5.0Gi 1.3Gi 385Mi 9.6Gi 10Gi
|
||||
Swap: 8.0Gi 58Mi 7.9Gi
|
||||
Mem: 15Gi 6.2Gi 2.7Gi 476Mi 7.1Gi 9.2Gi
|
||||
Swap: 8.0Gi 57Mi 7.9Gi
|
||||
podman version 6.2.0
|
||||
podman version 6.2.0
|
||||
podman-compose version 1.6.0
|
||||
@@ -16,4 +16,4 @@ docker.io/library/postgres:18.6-alpine3.24 57b23a0326ee
|
||||
docker.io/library/redis:8.10.3-alpine3.23 9722accf3e8e
|
||||
docker.io/migrate/migrate:v4.20.1 719a6f5d0ade
|
||||
docker.io/rustfs/rustfs:1.0.6 7cd1c573d76d
|
||||
localhost/messenger-api:lab4 ff3adbffb20b
|
||||
localhost/messenger-api:lab4 e2582dea4a72
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
2026-11-20T03:52:00+03:00
|
||||
2026-11-20T04:14:49+03:00
|
||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
|
||||
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": 86, "failed_attempts": 0, "first_recovery_seconds": 3.239}
|
||||
{"observed_instances_before": 2, "successful_writes": 101, "failed_attempts": 0, "first_recovery_seconds": 3.304}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
2026-11-20T03:52:32+03:00
|
||||
2026-11-20T04:15:25+03:00
|
||||
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||||
|
||||
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": 87, "failed_attempts": 0, "first_recovery_seconds": 3.236}
|
||||
{"observed_instances_before": 2, "successful_writes": 86, "failed_attempts": 0, "first_recovery_seconds": 3.228}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
2026-11-20T03:51:42+03:00
|
||||
2026-11-20T04:20:36+03:00
|
||||
make test-idempotency
|
||||
|
||||
BASE_URL="http://localhost:8080" python3 scripts/idempotency-race.py
|
||||
@@ -7,5 +7,5 @@ successful responses (201): 20
|
||||
failed requests: 0 []
|
||||
distinct message ids in responses: 1
|
||||
messages stored in history: 1
|
||||
instances that served requests: ['939e096de71a', 'dbc0d13c9b45']
|
||||
instances that served requests: ['8535d7918d12', 'ad1700491457']
|
||||
OK: exactly one message created
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
2026-11-20T03:53:27+03:00
|
||||
2026-11-20T04:21:39+03:00
|
||||
API replicas and single entrypoint
|
||||
|
||||
messenger-lab4_api_1 Up About a minute (healthy)
|
||||
messenger-lab4_api_2 Up 35 seconds (healthy)
|
||||
messenger-lab4_api_1 Up 26 seconds (healthy)
|
||||
messenger-lab4_api_2 Up 26 seconds (healthy)
|
||||
messenger-lab4_lb_1 Up About a minute
|
||||
messenger-lab4_postgres_1 Up About a minute (healthy)
|
||||
messenger-lab4_redis_1 Up About a minute (healthy)
|
||||
@@ -19,5 +19,5 @@ messenger-lab4_s3_1 9000-9001/tcp
|
||||
|
||||
X-Instance-Id distribution over 20 requests through LB
|
||||
|
||||
10 x-instance-id: 939e096de71a
|
||||
10 x-instance-id: dbc0d13c9b45
|
||||
10 x-instance-id: 33839df0eea0
|
||||
10 x-instance-id: 4e3d4c4f1194
|
||||
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
2026-11-20T03:53:28+03:00
|
||||
2026-11-20T04:17:58+03:00
|
||||
per-container limits, networks, secrets
|
||||
|
||||
messenger-lab4_api_1 nano_cpus=1000000000 memory=536870912 networks=messenger-lab4_backend messenger-lab4_edge
|
||||
@@ -7,13 +7,14 @@ messenger-lab4_lb_1 nano_cpus=500000000 memory=67108864 networks=messenger-lab4_
|
||||
messenger-lab4_postgres_1 nano_cpus=1000000000 memory=536870912 networks=messenger-lab4_backend
|
||||
messenger-lab4_redis_1 nano_cpus=500000000 memory=134217728 networks=messenger-lab4_backend
|
||||
messenger-lab4_s3_1 nano_cpus=1000000000 memory=536870912 networks=messenger-lab4_backend
|
||||
messenger-lab4_s3-init_1 nano_cpus=500000000 memory=268435456 networks=messenger-lab4_backend
|
||||
messenger-lab4_migrate_1 nano_cpus=500000000 memory=67108864 networks=messenger-lab4_backend
|
||||
|
||||
ls /run/secrets per container
|
||||
ls /run/secrets per running container
|
||||
|
||||
messenger-lab4_api_1: cache_url database_url s3_access_key_id s3_secret_access_key
|
||||
messenger-lab4_api_2: cache_url database_url s3_access_key_id s3_secret_access_key
|
||||
messenger-lab4_lb_1:
|
||||
messenger-lab4_postgres_1: postgres_password
|
||||
messenger-lab4_redis_1:
|
||||
messenger-lab4_s3_1: s3_access_key_id s3_secret_access_key
|
||||
messenger-lab4_s3_1: s3_root_access_key s3_root_secret_key
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
2026-11-20T04:21:28+03:00
|
||||
10 concurrent uploads of a 8000x5000 PNG (40,000,000 pixels) per replica; API memory limit 512 MiB; MAX_CONCURRENT_UPLOADS=8, MAX_CONCURRENT_DECODES=1
|
||||
|
||||
BASE_URL="http://localhost:8080" python3 scripts/upload-load.py --concurrency 10 --output evidence/upload-memory.json
|
||||
{
|
||||
"concurrency": 10,
|
||||
"uploads": 10,
|
||||
"fixture": "large.png",
|
||||
"fixture_bytes": 126609,
|
||||
"elapsed_seconds": 1.235,
|
||||
"successful": 10,
|
||||
"failed": 0,
|
||||
"failures": [],
|
||||
"latency_ms": {
|
||||
"p50": 663.7,
|
||||
"p95": 1224.7,
|
||||
"p99": 1224.7
|
||||
},
|
||||
"api_containers": [
|
||||
"messenger-lab4_api_1",
|
||||
"messenger-lab4_api_2"
|
||||
],
|
||||
"peak_bytes_before": {
|
||||
"messenger-lab4_api_1": 5050368,
|
||||
"messenger-lab4_api_2": 4820992
|
||||
},
|
||||
"peak_bytes_after": {
|
||||
"messenger-lab4_api_1": 368119808,
|
||||
"messenger-lab4_api_2": 368185344
|
||||
},
|
||||
"peak_delta_bytes": {
|
||||
"messenger-lab4_api_1": 363069440,
|
||||
"messenger-lab4_api_2": 363364352
|
||||
},
|
||||
"peak_max_mb": 351.13
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
2026-11-20T03:53:34+03:00
|
||||
2026-11-20T04:18:05+03:00
|
||||
migrate container logs and schema version
|
||||
|
||||
1/u init (12.217985ms)
|
||||
2/u message_idempotency (17.93178ms)
|
||||
3/u attachments (25.639306ms)
|
||||
1/u init (17.596326ms)
|
||||
2/u message_idempotency (23.558514ms)
|
||||
3/u attachments (35.669736ms)
|
||||
no change
|
||||
no change
|
||||
no change
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
2026-11-20T04:20:27+03:00
|
||||
make test-attachments
|
||||
|
||||
BASE_URL="http://localhost:8080" python3 scripts/attachments-check.py
|
||||
ok: upload 201 ready, sha256=99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75, size=111817
|
||||
ok: jpeg upload/download byte-identical; jpeg declared as png -> 415
|
||||
ok: png with 40,000,000 pixels accepted and downloaded byte-identical
|
||||
ok: filename with slash -> 400
|
||||
ok: filename with NUL -> 400
|
||||
ok: empty filename -> 400
|
||||
ok: declared jpeg with png body -> 415
|
||||
ok: truncated png -> 415
|
||||
ok: 10485761 bytes -> 413
|
||||
ok: text/plain -> 415
|
||||
ok: unknown variant -> 400
|
||||
ok: variant=original -> 200
|
||||
ok: unknown attachment id -> 404
|
||||
ok: upload by outsider -> 404
|
||||
ok: attachment from another chat -> 404
|
||||
ok: unknown attachment id in message -> 404
|
||||
ok: duplicate attachment_ids -> 400
|
||||
ok: eleven attachment_ids -> 400
|
||||
ok: empty text without attachments -> 400
|
||||
ok: idempotent replay with same attachment set -> same message
|
||||
ok: absent attachment_ids equals [] for idempotency
|
||||
ok: same key with a different attachment set -> 409
|
||||
ok: history exposes attachment_ids on every message
|
||||
PASS: 23 attachment contract checks
|
||||
+13
-13
@@ -1,4 +1,4 @@
|
||||
2026-11-20T03:51:42+03:00
|
||||
2026-11-20T04:19:38+03:00
|
||||
make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
||||
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
|
||||
@@ -7,12 +7,12 @@ PASS: persistence preserved confirmed data and existing session. Hook scope need
|
||||
|
||||
--- hook scope: containers and volumes before/after scripts/restart.sh ---
|
||||
|
||||
messenger-lab4_api_1 dbc0d13c9b45 Up About a minute (healthy)
|
||||
messenger-lab4_api_2 939e096de71a Up 42 seconds (healthy)
|
||||
messenger-lab4_lb_1 c2c6a2077627 Up About a minute
|
||||
messenger-lab4_postgres_1 a0b192c17952 Up About a minute (healthy)
|
||||
messenger-lab4_redis_1 f787abf8c4bf Up About a minute (healthy)
|
||||
messenger-lab4_s3_1 49ff0b0c9d92 Up About a minute (healthy)
|
||||
messenger-lab4_api_1 8535d7918d12 Up 1 second (starting)
|
||||
messenger-lab4_api_2 ad1700491457 Up 1 second (starting)
|
||||
messenger-lab4_lb_1 0bed57f994fa Up 1 second
|
||||
messenger-lab4_postgres_1 53c091ca7f0a Up 1 second (starting)
|
||||
messenger-lab4_redis_1 e0cfe44337f5 Up 1 second (healthy)
|
||||
messenger-lab4_s3_1 8548fb0864af Up 1 second (healthy)
|
||||
messenger-lab4_pgdata
|
||||
messenger-lab4_redisdata
|
||||
messenger-lab4_s3data
|
||||
@@ -20,12 +20,12 @@ messenger-lab4_s3data
|
||||
$ scripts/restart.sh
|
||||
|
||||
|
||||
messenger-lab4_api_1 dbc0d13c9b45 Up 15 seconds (healthy)
|
||||
messenger-lab4_api_2 939e096de71a Up 15 seconds (healthy)
|
||||
messenger-lab4_lb_1 c2c6a2077627 Up 15 seconds
|
||||
messenger-lab4_postgres_1 a0b192c17952 Up 16 seconds (healthy)
|
||||
messenger-lab4_redis_1 f787abf8c4bf Up 16 seconds (healthy)
|
||||
messenger-lab4_s3_1 49ff0b0c9d92 Up 16 seconds (healthy)
|
||||
messenger-lab4_api_1 8535d7918d12 Up 15 seconds (healthy)
|
||||
messenger-lab4_api_2 ad1700491457 Up 16 seconds (healthy)
|
||||
messenger-lab4_lb_1 0bed57f994fa Up 16 seconds
|
||||
messenger-lab4_postgres_1 53c091ca7f0a Up 15 seconds (healthy)
|
||||
messenger-lab4_redis_1 e0cfe44337f5 Up 15 seconds (healthy)
|
||||
messenger-lab4_s3_1 8548fb0864af Up 16 seconds (healthy)
|
||||
messenger-lab4_pgdata
|
||||
messenger-lab4_redisdata
|
||||
messenger-lab4_s3data
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
2026-11-20T04:15:49+03:00
|
||||
bucket privacy and disabled console (checks outside the application API)
|
||||
|
||||
$ wget http://s3:9000/messenger-attachments/chats/.../... (anonymous, from backend network)
|
||||
Connecting to s3:9000 (10.89.5.36:9000)
|
||||
HTTP/1.1 403 Forbidden
|
||||
wget: server returned error: HTTP/1.1 403 Forbidden
|
||||
|
||||
$ anonymous bucket listing
|
||||
Connecting to s3:9000 (10.89.5.36:9000)
|
||||
HTTP/1.1 403 Forbidden
|
||||
wget: server returned error: HTTP/1.1 403 Forbidden
|
||||
|
||||
$ console port check inside s3 container
|
||||
console_http=000
|
||||
console-closed
|
||||
|
||||
$ published ports
|
||||
messenger-lab4_api_2 8080/tcp
|
||||
messenger-lab4_s3_1 9000-9001/tcp
|
||||
@@ -0,0 +1,123 @@
|
||||
2026-11-20T04:13:27+03:00
|
||||
reconciler drill: baseline, grace period, dry-run, apply, repeat
|
||||
|
||||
$ scripts/reconcile.sh # dry-run, grace 1h, clean baseline
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 3600,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 15,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 7
|
||||
}
|
||||
|
||||
$ scripts/s3tool.sh put chats/aaaaaaaa-0000-4000-8000-000000000000/bbbbbbbb-0000-4000-8000-000000000000 - < scripts/fixtures/sample.jpg
|
||||
put chats/aaaaaaaa-0000-4000-8000-000000000000/bbbbbbbb-0000-4000-8000-000000000000 (653 bytes)
|
||||
|
||||
$ scripts/reconcile.sh # fresh orphan stays: grace 1h
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 3600,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 16,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 7
|
||||
}
|
||||
|
||||
$ scripts/reconcile.sh -grace 0s # orphan detected, dry-run keeps it
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 0,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 16,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [
|
||||
{
|
||||
"key": "chats/aaaaaaaa-0000-4000-8000-000000000000/bbbbbbbb-0000-4000-8000-000000000000",
|
||||
"size_bytes": 653,
|
||||
"last_modified": "2026-11-20T01:13:27Z",
|
||||
"age_seconds": 0
|
||||
}
|
||||
],
|
||||
"missing": [],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 6
|
||||
}
|
||||
|
||||
$ scripts/reconcile.sh -grace 0s -dry-run=false # apply
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 0,
|
||||
"dry_run": false,
|
||||
"scanned_objects": 16,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [
|
||||
{
|
||||
"key": "chats/aaaaaaaa-0000-4000-8000-000000000000/bbbbbbbb-0000-4000-8000-000000000000",
|
||||
"size_bytes": 653,
|
||||
"last_modified": "2026-11-20T01:13:27Z",
|
||||
"age_seconds": 3
|
||||
}
|
||||
],
|
||||
"missing": [],
|
||||
"deleted_objects": 1,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 12
|
||||
}
|
||||
|
||||
$ scripts/reconcile.sh -grace 0s -dry-run=false # repeat: nothing left
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 0,
|
||||
"dry_run": false,
|
||||
"scanned_objects": 15,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 7
|
||||
}
|
||||
|
||||
missing drill: metadata row without object
|
||||
|
||||
$ scripts/s3tool.sh delete chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c
|
||||
deleted chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c
|
||||
|
||||
$ scripts/reconcile.sh -grace 0s # reports missing, keeps metadata
|
||||
{
|
||||
"prefix": "chats/",
|
||||
"grace_seconds": 0,
|
||||
"dry_run": true,
|
||||
"scanned_objects": 14,
|
||||
"scanned_rows": 15,
|
||||
"truncated": false,
|
||||
"orphans": [],
|
||||
"missing": [
|
||||
{
|
||||
"id": "97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"object_key": "chats/9452049e-b86c-4d9a-8060-d98f6966b956/97121cfe-6b29-4227-867f-3188e72a725c",
|
||||
"chat_id": "9452049e-b86c-4d9a-8060-d98f6966b956",
|
||||
"created_at": "2026-11-20T01:11:14Z"
|
||||
}
|
||||
],
|
||||
"deleted_objects": 0,
|
||||
"delete_failures": 0,
|
||||
"duration_ms": 6
|
||||
}
|
||||
|
||||
metadata rows still present: 1
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
2026-11-20T03:51:29+03:00
|
||||
2026-11-20T04:20:26+03:00
|
||||
make test
|
||||
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
|
||||
+4
-16
@@ -1,17 +1,16 @@
|
||||
2026-11-20T03:53:23+03:00
|
||||
2026-11-20T04:18:15+03:00
|
||||
object bytes live in the RustFS volume, metadata in PostgreSQL
|
||||
|
||||
id | object_key | size_bytes | sha256
|
||||
--------------------------------------+---------------------------------------------------------------------------------+------------+------------------------------------------------------------------
|
||||
0df7c6fd-6ac6-488b-9803-73fee496586f | chats/70682cfc-bf33-4f15-8de6-e85972fc95e0/0df7c6fd-6ac6-488b-9803-73fee496586f | 111817 | 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
|
||||
3dbc5415-9791-4983-a253-bc71fdc79a24 | chats/3ec617cd-fddf-4ae1-ad9d-37a4bb319b76/3dbc5415-9791-4983-a253-bc71fdc79a24 | 126609 | 518fd54cb19f8ceaca99139652fb96ed3a5d502392450846c832924b1722d2bf
|
||||
(1 row)
|
||||
|
||||
|
||||
S3 volume listing for that object
|
||||
|
||||
/data/messenger-attachments/chats/70682cfc-bf33-4f15-8de6-e85972fc95e0/0df7c6fd-6ac6-488b-9803-73fee496586f:
|
||||
total 112
|
||||
-rw-r--r-- 1 rustfs rustfs 112398 Nov 20 00:52 xl.meta
|
||||
total 128
|
||||
-rw-r--r-- 1 rustfs rustfs 127190 Nov 20 01:17 xl.meta
|
||||
|
||||
attachments table columns (no binary content)
|
||||
|
||||
@@ -31,14 +30,3 @@ attachments table columns (no binary content)
|
||||
updated_at | timestamp with time zone
|
||||
(12 rows)
|
||||
|
||||
|
||||
anonymous S3 GET without credentials
|
||||
|
||||
Connecting to s3:9000 (10.89.5.10:9000)
|
||||
HTTP/1.1 403 Forbidden
|
||||
wget: server returned error: HTTP/1.1 403 Forbidden
|
||||
|
||||
admin console port (must be closed)
|
||||
|
||||
000
|
||||
console-closed
|
||||
|
||||
+29
-16
@@ -1,6 +1,9 @@
|
||||
2026-11-20T03:54:42+03:00
|
||||
2026-11-20T04:20:28+03:00
|
||||
make test-go
|
||||
|
||||
? messenger/cmd/reconcile [no test files]
|
||||
? messenger/cmd/s3-init [no test files]
|
||||
? messenger/cmd/s3tool [no test files]
|
||||
? messenger/cmd/server [no test files]
|
||||
? messenger/internal/config [no test files]
|
||||
? messenger/internal/domain [no test files]
|
||||
@@ -11,36 +14,46 @@ make test-go
|
||||
=== RUN TestWrongPassword
|
||||
--- PASS: TestWrongPassword (0.10s)
|
||||
=== RUN TestRedisUnavailable
|
||||
redis: 2026/11/20 03:54:46 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 03:54:46 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 03:54:47 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 03:54:47 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 03:54:47 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 03:54:48 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
--- PASS: TestRedisUnavailable (2.81s)
|
||||
redis: 2026/11/20 04:20:32 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:32 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:33 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:33 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:34 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:34 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
--- PASS: TestRedisUnavailable (2.83s)
|
||||
=== RUN TestDatabaseUnavailable
|
||||
--- PASS: TestDatabaseUnavailable (0.17s)
|
||||
=== RUN TestInvalidJSON
|
||||
--- PASS: TestInvalidJSON (0.01s)
|
||||
=== RUN TestForeignChat
|
||||
--- PASS: TestForeignChat (0.18s)
|
||||
--- PASS: TestForeignChat (0.16s)
|
||||
=== RUN TestEmptyMessage
|
||||
redis: 2026/11/20 03:54:48 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
redis: 2026/11/20 04:20:35 pool.go:770: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
|
||||
--- PASS: TestEmptyMessage (0.08s)
|
||||
=== RUN TestDuplicateUsername
|
||||
--- PASS: TestDuplicateUsername (0.09s)
|
||||
--- PASS: TestDuplicateUsername (0.10s)
|
||||
=== RUN TestPaginationMultiplePages
|
||||
--- PASS: TestPaginationMultiplePages (0.09s)
|
||||
--- PASS: TestPaginationMultiplePages (0.08s)
|
||||
=== RUN TestConcurrentMessages
|
||||
--- PASS: TestConcurrentMessages (0.57s)
|
||||
--- PASS: TestConcurrentMessages (0.59s)
|
||||
PASS
|
||||
ok messenger/internal/handler 7.289s
|
||||
ok messenger/internal/handler 7.325s
|
||||
=== RUN TestPlanDetectsOrphansAndMissing
|
||||
--- PASS: TestPlanDetectsOrphansAndMissing (0.00s)
|
||||
=== RUN TestPlanHonoursGraceAndPrefix
|
||||
--- PASS: TestPlanHonoursGraceAndPrefix (0.00s)
|
||||
=== RUN TestPlanNeverDeletesReferencedObjects
|
||||
--- PASS: TestPlanNeverDeletesReferencedObjects (0.00s)
|
||||
=== RUN TestPlanOutputIsSorted
|
||||
--- PASS: TestPlanOutputIsSorted (0.00s)
|
||||
PASS
|
||||
ok messenger/internal/reconcile 0.002s
|
||||
=== RUN TestRegisterUsernameRace
|
||||
--- PASS: TestRegisterUsernameRace (0.05s)
|
||||
=== RUN TestCreateChatRollback
|
||||
--- PASS: TestCreateChatRollback (0.01s)
|
||||
--- PASS: TestCreateChatRollback (0.02s)
|
||||
PASS
|
||||
ok messenger/internal/repository/postgres 0.072s
|
||||
ok messenger/internal/repository/postgres 0.071s
|
||||
? messenger/internal/repository/redis [no test files]
|
||||
? messenger/internal/repository/s3 [no test files]
|
||||
? messenger/internal/router [no test files]
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"concurrency": 10,
|
||||
"uploads": 10,
|
||||
"fixture": "large.png",
|
||||
"fixture_bytes": 126609,
|
||||
"elapsed_seconds": 1.235,
|
||||
"successful": 10,
|
||||
"failed": 0,
|
||||
"failures": [],
|
||||
"latency_ms": {
|
||||
"p50": 663.7,
|
||||
"p95": 1224.7,
|
||||
"p99": 1224.7
|
||||
},
|
||||
"api_containers": [
|
||||
"messenger-lab4_api_1",
|
||||
"messenger-lab4_api_2"
|
||||
],
|
||||
"peak_bytes_before": {
|
||||
"messenger-lab4_api_1": 5050368,
|
||||
"messenger-lab4_api_2": 4820992
|
||||
},
|
||||
"peak_bytes_after": {
|
||||
"messenger-lab4_api_1": 368119808,
|
||||
"messenger-lab4_api_2": 368185344
|
||||
},
|
||||
"peak_delta_bytes": {
|
||||
"messenger-lab4_api_1": 363069440,
|
||||
"messenger-lab4_api_2": 363364352
|
||||
},
|
||||
"peak_max_mb": 351.13
|
||||
}
|
||||
Reference in New Issue
Block a user