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.
This commit is contained in:
Heikki Linnakangas 2015-07-28 11:30:23 +03:00
parent 5e65f45c6e
commit b2ed8edeec
1 changed files with 2 additions and 2 deletions

View File

@ -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);