1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""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)