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 <cursoragent@cursor.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user