ЛР 4: подтвердить окончательные проверки отказов и целостность доказательств

This commit is contained in:
2026-10-27 13:19:00 +03:00
parent 96007f4c5a
commit 2c7a00948a
5 changed files with 65 additions and 21 deletions
+33
View File
@@ -0,0 +1,33 @@
{
"replicas": [
{
"container": "bf045a5f2da07f277b60fa4218fad624b82fa3f05c3d4870d379eef6ceb5608a",
"uploader": "410dddf690ef439bbaf15193aa235099",
"downloader": "9e726cd692f7474f856feaf1ebea5577",
"confirmed_stopped": true,
"transient_write_failures": 0,
"recovery_seconds": 1.818,
"sha256": "99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75",
"exit_code": 0,
"oom_killed": false
},
{
"container": "15c86e71f1c1c806a7b585fc3fc5c499f886408f75bc90defe3355c8377e49e8",
"uploader": "9e726cd692f7474f856feaf1ebea5577",
"downloader": "882125d9d2834b7aab25eb78c9f99a5e",
"confirmed_stopped": true,
"transient_write_failures": 0,
"recovery_seconds": 1.846,
"sha256": "99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75",
"exit_code": 0,
"oom_killed": false
}
],
"interrupted_before_validation_leaves_no_intent": true,
"s3_outage": {
"ready": 503,
"content": 503,
"live": 200
},
"redis_outage_fallback": true
}
+2
View File
@@ -0,0 +1,2 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
+19 -19
View File
@@ -6,7 +6,7 @@
"image": "mtusi-messenger:lab4",
"user": "10001:10001",
"running": true,
"started_at": "2026-10-27T10:15:42.778343664Z",
"started_at": "2026-10-27T10:18:07.132235089Z",
"exit_code": 0,
"oom_killed": false,
"memory_limit": 536870912,
@@ -15,11 +15,6 @@
"8080/tcp": null
},
"mounts": [
{
"type": "bind",
"destination": "/run/secrets/s3_api_key",
"name": null
},
{
"type": "bind",
"destination": "/run/secrets/s3_api_secret",
@@ -34,6 +29,11 @@
"type": "bind",
"destination": "/run/secrets/cache_url",
"name": null
},
{
"type": "bind",
"destination": "/run/secrets/s3_api_key",
"name": null
}
]
},
@@ -44,7 +44,7 @@
"image": "mtusi-messenger:lab4",
"user": "10001:10001",
"running": true,
"started_at": "2026-10-27T10:15:42.719072973Z",
"started_at": "2026-10-27T10:18:14.915499757Z",
"exit_code": 0,
"oom_killed": false,
"memory_limit": 536870912,
@@ -143,11 +143,6 @@
"nano_cpus": 1000000000,
"ports": {},
"mounts": [
{
"type": "bind",
"destination": "/run/secrets/database_url",
"name": null
},
{
"type": "bind",
"destination": "/run/secrets/cache_url",
@@ -162,6 +157,11 @@
"type": "bind",
"destination": "/run/secrets/s3_api_secret",
"name": null
},
{
"type": "bind",
"destination": "/run/secrets/database_url",
"name": null
}
]
},
@@ -200,7 +200,7 @@
"image": "redis:7.4.1-bookworm@sha256:bb142a9c18ac18a16713c1491d779697b4e107c22a97266616099d288237ef47",
"user": "",
"running": true,
"started_at": "2026-10-27T10:05:27.855523719Z",
"started_at": "2026-10-27T10:18:25.256591097Z",
"exit_code": 0,
"oom_killed": false,
"memory_limit": 67108864,
@@ -223,7 +223,7 @@
"image": "chrislusf/seaweedfs:4.51@sha256:f7a49e3f3972ebed5be2ed4befa4a0c68eb7bdddba6e692d42729ceb545134b8",
"user": "",
"running": true,
"started_at": "2026-10-27T10:05:27.820013219Z",
"started_at": "2026-10-27T10:18:22.341659035Z",
"exit_code": 0,
"oom_killed": false,
"memory_limit": 536870912,
@@ -239,15 +239,15 @@
"9333/tcp": null
},
"mounts": [
{
"type": "volume",
"destination": "/data",
"name": "14783007132b79e82933ac71a5d25b4559f3af285106fb42539e7967bef98ffa"
},
{
"type": "bind",
"destination": "/run/secrets/s3_config",
"name": null
},
{
"type": "volume",
"destination": "/data",
"name": "14783007132b79e82933ac71a5d25b4559f3af285106fb42539e7967bef98ffa"
}
]
},
+11 -2
View File
@@ -68,8 +68,17 @@ def main():
except Failure:
assert time.monotonic() - started < 10
time.sleep(.1)
c.message(alice, chat, 'write survives stop')
report['replicas'].append({'container': container, 'uploader': alias, 'downloader': data['headers']['X-Instance-Id'], 'confirmed_stopped': True, 'recovery_seconds': round(time.monotonic() - started, 3), 'sha256': hashlib.sha256(data['bytes']).hexdigest(), 'exit_code': state['ExitCode'], 'oom_killed': state['OOMKilled']})
key = uuid.uuid4().hex
write_failures = 0
while True:
try:
c.message(alice, chat, 'write survives stop', key=key)
break
except Failure:
write_failures += 1
assert time.monotonic() - started < 10
time.sleep(.1)
report['replicas'].append({'container': container, 'uploader': alias, 'downloader': data['headers']['X-Instance-Id'], 'confirmed_stopped': True, 'transient_write_failures': write_failures, 'recovery_seconds': round(time.monotonic() - started, 3), 'sha256': hashlib.sha256(data['bytes']).hexdigest(), 'exit_code': state['ExitCode'], 'oom_killed': state['OOMKilled']})
finally:
docker('compose', 'up', '-d', '--wait', '--no-deps', 'api')
wait(c)