forked from mtusi2026/mtusi2026lab5
test(pipeline): record verified limits and complete cluster recovery evidence
This commit is contained in:
@@ -286,3 +286,21 @@ private/IAM/otherAPI. Это целевой повтор, а не19cases пол
|
||||
проходит handoff predicate. Fixture metadata failed состарены SQL отдельно,
|
||||
но возраст S3 LastModified не подменялся. Cleanup fixtures синтетические и
|
||||
не обещают восстановление bytes из checksum.
|
||||
|
||||
Для финальной проверки worker перед fault hook сохраняет diagnostic event
|
||||
worker_resource_limits с фактическим RLIMIT_AS и cgroup memory.max/cpu.max.
|
||||
Сбор показаний самим child исключает влияние медленного внешнего DockerCLI
|
||||
на12s test budget. Это диагностическое добавление также проверяется новым
|
||||
образом из чистого clone; предыдущие HTTP/source evidence не переименованы.
|
||||
|
||||
Первый cluster receipt [cluster-first-failed.json](evidence/cluster-first-failed.json)
|
||||
сохраняет успешные отказы двухAPI. Rolling занял дольше45s окна, поэтому
|
||||
генератор завершился сразу с action и не получил post-action observation.
|
||||
Verifier теперь обязательно наблюдает ещё2s после action, сохраняя все
|
||||
проверки данных и failover≤10s. Это исправление наблюдения, не ослабление SLA.
|
||||
|
||||
[evidence/cluster-first.json](evidence/cluster-first.json): complete PASS;
|
||||
API failovers (writes/errors/recovery seconds): 214/6/3.086, 216/8/2.762.
|
||||
Rolling: 730 confirmed writes, 18 transient errors; все исходныеAPI заменены, данные/replay сохранены.
|
||||
Public failover/persistence PASS; StartedAt PG/cache/S3/broker/LB изменились,
|
||||
прежний token и file сохранились. Это не zero-error rolling.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -413,22 +413,11 @@ def main():
|
||||
marker = inject(j, "before_effect", "hang")
|
||||
start("worker")
|
||||
wait(lambda: hit(marker))
|
||||
cid = compose("ps", "-q", "worker").split()[0]
|
||||
code = """import json,pathlib,re
|
||||
limits=[]
|
||||
for p in pathlib.Path('/proc').glob('[0-9]*/limits'):
|
||||
try:
|
||||
line=next(x for x in p.read_text().splitlines() if x.startswith('Max address space'))
|
||||
if re.search(r'805306368\\s+805306368',line): limits.append({'pid':p.parent.name,'limit':line})
|
||||
except (FileNotFoundError,PermissionError,StopIteration,ProcessLookupError): pass
|
||||
root=pathlib.Path('/sys/fs/cgroup')
|
||||
print(json.dumps({'bounded_children':limits,'cgroup':{n:(root/n).read_text().strip() for n in ['memory.max','memory.current','memory.peak','cpu.max','pids.current']}}))
|
||||
"""
|
||||
limits = json.loads(
|
||||
command(["docker", "exec", cid, "python", "-c", code])
|
||||
limits = inside(
|
||||
f"with db.connection() as c: r=c.execute(\"SELECT detail FROM pipeline_events WHERE job_id=%s AND event='worker_resource_limits' ORDER BY id DESC LIMIT 1\",({j!r},)).fetchone()\nprint(json.dumps(r['detail']))"
|
||||
)
|
||||
assert 1 <= len(limits["bounded_children"]) <= 2
|
||||
assert limits["cgroup"]["memory.max"] == "1610612736"
|
||||
assert limits["address_space_bytes"] == [805306368, 805306368]
|
||||
assert limits["memory.max"] == "1610612736"
|
||||
effect = confirm(a, j)
|
||||
assert any(
|
||||
e["event"] == "retry"
|
||||
|
||||
@@ -7,6 +7,7 @@ import multiprocessing
|
||||
import resource
|
||||
import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
import redis
|
||||
@@ -122,6 +123,20 @@ def process(job_id, fence, sender):
|
||||
if not row:
|
||||
sender.send({"result": "stale"})
|
||||
return
|
||||
# Record limits before fault hooks: a slow external inspector must not
|
||||
# consume the child timeout while attempting to observe the limit.
|
||||
cgroup = Path("/sys/fs/cgroup")
|
||||
limits = {
|
||||
name: (cgroup / name).read_text().strip()
|
||||
if (cgroup / name).exists()
|
||||
else "unavailable"
|
||||
for name in ["memory.max", "cpu.max"]
|
||||
}
|
||||
limits["address_space_bytes"] = list(
|
||||
resource.getrlimit(resource.RLIMIT_AS)
|
||||
)
|
||||
with db.connection() as conn:
|
||||
event(conn, job_id, "worker_resource_limits", limits)
|
||||
fault(db, job_id, "before_effect")
|
||||
upstream = store.get(key=row["source_key"])
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user