diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-28 11:30:23 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2015-07-28 11:30:23 +0300 |
commit | b2ed8edeecd715c8a23ae462da843578e5cde7f4 (patch) | |
tree | 3d448f454c050f721e034d992e833bdff0238bac /src | |
parent | 5e65f45c6eff8278e2901511da61d3a265adc874 (diff) | |
download | postgresql-b2ed8edeecd715c8a23ae462da843578e5cde7f4.tar.gz postgresql-b2ed8edeecd715c8a23ae462da843578e5cde7f4.zip |
Fix bug in collecting total_latencies from all threads in pgbench.
This was broken in 1bc90f7a, which removed the thread-emulation. With modest
-j and -c settings the result were usually close enough that you wouldn't
notice it easily, but with a high enough thread count it would access
uninitialized memory and crash.
Per report from Andres Freund offlist.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pgbench/pgbench.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index e839fa36567..3b8a80fa7ad 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3456,8 +3456,8 @@ main(int argc, char **argv) for (j = 0; j < thread->nstate; j++) { total_xacts += thread->state[j].cnt; - total_latencies += thread->state[i].txn_latencies; - total_sqlats += thread->state[i].txn_sqlats; + total_latencies += thread->state[j].txn_latencies; + total_sqlats += thread->state[j].txn_sqlats; } } disconnect_all(state, nclients); |