From 4ea96dfc09162e97fc0ea0f2e646d3a09a2259a6 Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Thu, 15 Oct 2026 22:26:11 +0800 Subject: [PATCH] ci: fail a durable pinned crash cycle unless its pin row survives once The pinned cell's one row is acknowledged before the writers start, so the oracle now fails a durable cycle whose pin table does not hold exactly that row after the restart, and any cycle that holds it twice. Signed-off-by: jeremyhi --- .github/scripts/oswal-s3-bench-crash.py | 3 +++ .github/scripts/oswal-s3-bench-run.sh | 9 +++++---- tests/perf/test_oswal_s3_bench_scripts.py | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/scripts/oswal-s3-bench-crash.py b/.github/scripts/oswal-s3-bench-crash.py index 92e7c5c3923..b51f801da8f 100644 --- a/.github/scripts/oswal-s3-bench-crash.py +++ b/.github/scripts/oswal-s3-bench-crash.py @@ -195,6 +195,7 @@ def main() -> int: c.add_argument("--mode", choices=("durable", "enqueued"), required=True) for name in ("writers", "rows", "before-ns", "after-ns", "window-max-ms"): c.add_argument(f"--{name}", type=int, required=True) + c.add_argument("--pin-rows", type=int, help="rows of the pin table, whose one row was acknowledged first") args = parser.parse_args() if args.command == "write": return write(args) @@ -204,6 +205,8 @@ def main() -> int: args.window_max_ms) result |= verify(args.run_dir, {int(seq): int(count) for seq, count in rows}, args.rows, args.mode == "enqueued", args.cycle) + if args.pin_rows is not None and (args.pin_rows > 1 or args.mode == "durable" and args.pin_rows != 1): + result["verify_errors"].append(f"the pin table holds {args.pin_rows} rows, not 1") result["passed"] = not result["kill_errors"] and not result["verify_errors"] print(json.dumps(result)) return 0 if result["passed"] else 1 diff --git a/.github/scripts/oswal-s3-bench-run.sh b/.github/scripts/oswal-s3-bench-run.sh index 2ae4f8f9162..b6ba1b07dc4 100644 --- a/.github/scripts/oswal-s3-bench-run.sh +++ b/.github/scripts/oswal-s3-bench-run.sh @@ -171,7 +171,7 @@ sample_objects() { # server; it restarts on the same prefix and data home and the table is checked # against what was acknowledged. Nothing is cleaned between cycles. crash_cycles() { - local writers rows cycles kill_min kill_max cycle cdir wpid spid= delay before after started restart_s query_s next=0 pin_count + local writers rows cycles kill_min kill_max cycle cdir wpid spid= delay before after started restart_s query_s next=0 pin_count pin_args local load_start complete sql_url=${OSWAL_SQL_URL:-http://127.0.0.1:4000/v1/sql?db=public} writers=$(jq -r .concurrency <<< "$spec") rows=$(jq -r .batch_rows "$PLAN") cycles=$(jq -r .cycles <<< "$spec") kill_min=$(jq -r '.kill_after[0]' <<< "$spec") kill_max=$(jq -r '.kill_after[1]' <<< "$spec") @@ -205,14 +205,15 @@ crash_cycles() { done query_s=$(elapsed "$started") scrape_retry recovery_seconds_count || complete=false - pin_count=null + pin_count=null pin_args=() if jq -e .pin <<< "$spec" >/dev/null; then - pin_count=$(sql "SELECT count(*) FROM pin" | jq -er '.output[0].records.rows[0][0]') + pin_count=$(sql "SELECT count(*) FROM pin" | jq -er '.output[0].records.rows[0][0]') pin_args=(--pin-rows "$pin_count") fi local verdict=0 python3 "$here/oswal-s3-bench-crash.py" check --run-dir "$dir" --cycle "$cycle" --found "$cdir/found.json" \ --mode "$(jq -r .wal.ACK_MODE <<< "$spec")" --writers "$writers" --rows "$rows" \ - --before-ns "$before" --after-ns "$after" --window-max-ms 2000 > "$cdir/check.json" || verdict=$? + --before-ns "$before" --after-ns "$after" --window-max-ms 2000 ${pin_args[@]+"${pin_args[@]}"} \ + > "$cdir/check.json" || verdict=$? jq -c --arg delay "$delay" --arg restart "$restart_s" --arg query "$query_s" --argjson pin "$pin_count" \ --argjson load "$(awk -v a="$load_start" -v b="$before" 'BEGIN {printf "%.3f", (b - a) / 1e9}')" \ --argjson complete "$complete" \ diff --git a/tests/perf/test_oswal_s3_bench_scripts.py b/tests/perf/test_oswal_s3_bench_scripts.py index f7f0243357e..1d4524c272e 100644 --- a/tests/perf/test_oswal_s3_bench_scripts.py +++ b/tests/perf/test_oswal_s3_bench_scripts.py @@ -857,7 +857,8 @@ class CellLifecycleTest(unittest.TestCase): # the run script against fake docke "OSWAL_SAMPLE_SECONDS": "0.2", "FAKE_SAMPLE_RC": str(sample_rc), "FAKE_FULL_METRICS": full_metrics} | (env or {})) try: - return self.run_cells(root, load_rc=0, metrics_rc=metrics_rc, groups=groups) + return self.run_cells(root, load_rc=0, metrics_rc=metrics_rc, groups=groups, + count=(env or {}).get("FAKE_COUNT", 6000)) finally: os.environ.clear() os.environ.update(old) @@ -889,7 +890,7 @@ class CellLifecycleTest(unittest.TestCase): # the run script against fake docke def test_failed_pinned_samples_are_missing_not_zero(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory) - cells, _, log, _ = self.run_crash(root, pin=True, sample_rc=28) + cells, _, log, _ = self.run_crash(root, pin=True, sample_rc=28, env={"FAKE_COUNT": "1"}) self.assertEqual(cells.returncode, 0, cells.stdout + cells.stderr) cell = root / "results" / "cells" / "crash-1-8-D" samples = (cell / "objects.tsv").read_text().splitlines() @@ -897,6 +898,17 @@ class CellLifecycleTest(unittest.TestCase): # the run script against fake docke self.assertIn("sql=INSERT INTO pin VALUES (1, 0)", log) self.assertEqual(len((cell / "cycles.jsonl").read_text().splitlines()), 2) + def test_a_durable_pinned_cycle_fails_unless_its_pin_row_is_there_once(self): + for count in ("0", "2"): + with self.subTest(count=count), tempfile.TemporaryDirectory() as directory: + root = Path(directory) + self.run_crash(root, pin=True, env={"FAKE_COUNT": count}) + cell = root / "results" / "cells" / "crash-1-8-D" + cycle = json.loads((cell / "cycles.jsonl").read_text().splitlines()[0]) + self.assertEqual((cycle["passed"], cycle["pin_rows"]), (False, int(count))) + self.assertIn(f"the pin table holds {count} rows, not 1", cycle["verify_errors"]) + self.assertEqual(json.loads((cell / "cell.json").read_text())["exit_code"], 6) + def test_a_scrape_without_the_wal_samples_is_incomplete(self): with tempfile.TemporaryDirectory() as directory: root = Path(directory)