summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2014-12-16 19:53:55 +0000
committerTom Lane2014-12-16 19:53:55 +0000
commitde8e46f5f5785f4016aabf2aa231faa89a0746fb (patch)
tree33fd5552d75db5e771557f22348be5e21121b755
parentd38e8d30cecea96a088330133e232c465a222d0a (diff)
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.
-rw-r--r--contrib/pgbench/pgbench.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index 397403f221c..d69036a2f5c 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -2541,6 +2541,10 @@ printResults(int ttype, int64 normal_xacts, int nclients,
normal_xacts);
}
+ /* Remaining stats are nonsensical if we failed to execute any xacts */
+ if (normal_xacts <= 0)
+ return;
+
if (throttle_delay && latency_limit)
printf("number of transactions skipped: " INT64_FORMAT " (%.3f %%)\n",
throttle_latency_skipped,