postgres.git / summary / log / commit / refs
commit b2ed8edeecd715c8a23ae462da843578e5cde7f4
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Tue Jul 28 08:30:23 2015 +0000
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.
src/bin/pgbench/pgbench.c | 4 ++--
1 file 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);
[parent: 5e65f45c6eff]