From 5f8de0fc55358e31db764d8f863970a6ded8a57b Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 13:19:11 +0000 Subject: [PATCH] Fix pgbench latency samples so summaries exclude the text log Why: The percentile reader also opened the pgbench stdout file, so the first run exited 1 after six successful windows. Evidence: Parser check on results/pgbench-20261012-131229 select-only-10 gave p50 0.018 ms, matching the reported average. The timed rerun is recorded next. Impact: Percentile parsing only. The six windows themselves had zero failed transactions. Refs: docs/release-multi-instance.md B6 Co-authored-by: Cursor --- tests/load/collaboration/run_pgbench.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/load/collaboration/run_pgbench.sh b/tests/load/collaboration/run_pgbench.sh index 07fcd670..05f394cd 100755 --- a/tests/load/collaboration/run_pgbench.sh +++ b/tests/load/collaboration/run_pgbench.sh @@ -243,25 +243,30 @@ for raw in "${client_list[@]}"; do echo "[pgbench] failed transactions = ${failed:-missing} for $mode/$clients" >&2 exit 1 } - read -r p50 p95 p99 samples <<<"$(python3 - "$prefix" <<'PY' -import glob, sys + stats="$(python3 - "$prefix" <<'PY' +import glob, os, re, sys prefix = sys.argv[1] +base = os.path.basename(prefix) +pat = re.compile(re.escape(base) + r"\.\d+(?:\.\d+)?$") vals = [] for path in sorted(glob.glob(prefix + ".*")): + if not pat.match(os.path.basename(path)): + continue with open(path) as fh: for line in fh: parts = line.split() - if len(parts) >= 3: + if len(parts) >= 3 and parts[2].isdigit(): vals.append(int(parts[2])) +if not vals: + sys.exit("no latency samples under " + prefix) vals.sort() def pct(p): - if not vals: - return "nan" idx = int(round((p / 100.0) * (len(vals) - 1))) return f"{vals[idx] / 1000.0:.3f}" print(pct(50), pct(95), pct(99), len(vals)) PY -)" +)" || exit 1 + read -r p50 p95 p99 samples <<<"$stats" awk -v p50="$p50" 'BEGIN { if (p50+0 > 60000) exit 1 }' || { echo "[pgbench] latency sample looks unparsed (p50=${p50}ms)" >&2 exit 1