Hi, I found that pgbench could get stuck when every transaction come to be skipped and the number of transaction is not limitted by -t option.
For example, when I usee a large rate (-R) for throttling and a small latency limit (-L) values with a duration (-T), pbbench got stuck. $ pgbench -T 5 -R 100000000 -L 1; When we specify the number of transactions by -t, it doesn't get stuck because the number of skipped transactions are counted and checked during the loop. However, the timer expiration is not checked in the loop although it is checked before and after a sleep for throttling. I think it is better to check the timer expiration even in the loop of transaction skips and to finish pgbnech successfully because we should correcly repport how many transactions are proccessed and skipped also in this case, and getting stuck would not be good anyway. I attached a patch for this fix. Regards, Yugo Nagata -- Yugo NAGATA <nag...@sraoss.co.jp>
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index dc84b7b9b7..1aa3e6b7be 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3232,7 +3232,8 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg) pg_time_now_lazy(&now); while (thread->throttle_trigger < now - latency_limit && - (nxacts <= 0 || st->cnt < nxacts)) + (nxacts <= 0 || st->cnt < nxacts) && + !timer_exceeded) { processXactStats(thread, st, &now, true, agg); /* next rendez-vous */