Skip to content

Commit 9a65fb3

Browse files
committed
Allow total number of transactions in pgbench to exceed INT_MAX.
Change the total-transactions counters from int32 to int64 to accommodate cases where we do more than 2^31 transactions during a run. This patch does not change the INT_MAX limit on explicit "-t" parameters, but it does allow the product of the -t and -c parameters to exceed INT_MAX, or allow a -T limit that is large enough that more than 2^31 transactions can be completed. While pgbench did not actually fail in such cases, it did print an incorrect total-transactions count, and some of the derived numbers such as TPS would have been wrong as well. Tomas Vondra
1 parent 9fa9353 commit 9a65fb3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

contrib/pgbench/pgbench.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ typedef struct
239239
typedef struct
240240
{
241241
instr_time conn_time;
242-
int xacts;
242+
int64 xacts;
243243
int64 latencies;
244244
int64 sqlats;
245245
int64 throttle_lag;
@@ -2180,7 +2180,7 @@ process_builtin(char *tb)
21802180

21812181
/* print out results */
21822182
static void
2183-
printResults(int ttype, int normal_xacts, int nclients,
2183+
printResults(int ttype, int64 normal_xacts, int nclients,
21842184
TState *threads, int nthreads,
21852185
instr_time total_time, instr_time conn_total_time,
21862186
int64 total_latencies, int64 total_sqlats,
@@ -2213,13 +2213,13 @@ printResults(int ttype, int normal_xacts, int nclients,
22132213
if (duration <= 0)
22142214
{
22152215
printf("number of transactions per client: %d\n", nxacts);
2216-
printf("number of transactions actually processed: %d/%d\n",
2217-
normal_xacts, nxacts * nclients);
2216+
printf("number of transactions actually processed: " INT64_FORMAT "/" INT64_FORMAT "\n",
2217+
normal_xacts, (int64) nxacts * nclients);
22182218
}
22192219
else
22202220
{
22212221
printf("duration: %d s\n", duration);
2222-
printf("number of transactions actually processed: %d\n",
2222+
printf("number of transactions actually processed: " INT64_FORMAT "\n",
22232223
normal_xacts);
22242224
}
22252225

@@ -2359,7 +2359,7 @@ main(int argc, char **argv)
23592359
instr_time start_time; /* start up time */
23602360
instr_time total_time;
23612361
instr_time conn_total_time;
2362-
int total_xacts = 0;
2362+
int64 total_xacts = 0;
23632363
int64 total_latencies = 0;
23642364
int64 total_sqlats = 0;
23652365
int64 throttle_lag = 0;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy