Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2ed8ed

Browse files
committed
Fix bug in collecting total_latencies from all threads in pgbench.
This was broken in 1bc90f7, 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.
1 parent 5e65f45 commit b2ed8ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/pgbench/pgbench.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3456,8 +3456,8 @@ main(int argc, char **argv)
34563456
for (j = 0; j < thread->nstate; j++)
34573457
{
34583458
total_xacts += thread->state[j].cnt;
3459-
total_latencies += thread->state[i].txn_latencies;
3460-
total_sqlats += thread->state[i].txn_sqlats;
3459+
total_latencies += thread->state[j].txn_latencies;
3460+
total_sqlats += thread->state[j].txn_sqlats;
34613461
}
34623462
}
34633463
disconnect_all(state, nclients);

0 commit comments

Comments
 (0)