Skip to content

Commit de8e46f

Browse files
committed
Suppress bogus statistics when pgbench failed to complete any transactions.
Code added in 9.4 would attempt to divide by zero in such cases. Noted while testing fix for missing-pclose problem.
1 parent d38e8d3 commit de8e46f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contrib/pgbench/pgbench.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,6 +2541,10 @@ printResults(int ttype, int64 normal_xacts, int nclients,
25412541
normal_xacts);
25422542
}
25432543

2544+
/* Remaining stats are nonsensical if we failed to execute any xacts */
2545+
if (normal_xacts <= 0)
2546+
return;
2547+
25442548
if (throttle_delay && latency_limit)
25452549
printf("number of transactions skipped: " INT64_FORMAT " (%.3f %%)\n",
25462550
throttle_latency_skipped,

0 commit comments

Comments
 (0)