~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zlay

atproto relay in zig · mirror of https://tangled.org/zat.dev/zlay

0
0
22 lines · 1.1 KB Raw History
"""SIGKILL after acknowledged new memberships, before normal database close."""
import json
from pathlib import Path
import signal
import subprocess
import sys

binary, database, count = sys.argv[1:]
count = int(count)
end = count + 4096
result = subprocess.run([binary, database, 'crash-add', str(count), str(end), '0'],
                        capture_output=True, text=True, timeout=180)
Path(database + '-crash-add.log').write_text(result.stdout + result.stderr)
assert result.returncode == -signal.SIGKILL, result
assert 'space,crash-add,8192,' in result.stderr, result.stderr
verification = subprocess.run([binary, database, 'verify', '0', str(end), '0'],
                              capture_output=True, text=True, timeout=300)
Path(database + '-crash-verify.log').write_text(verification.stdout + verification.stderr)
assert verification.returncode == 0, verification.stderr
print(json.dumps(dict(binary=binary, initial_dids=count, recovered_dids=end,
                      recovered_memberships=end * 2, signal=9,
                      verification='passed')), flush=True)