Re: [HACKERS] random() in multi-threaded pgbench

2009-12-11 Thread Tom Lane
Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes: While testing the pgbench setshell command patch with -j option, I found all threads use the same sequence of random value. Were they actually threads, or were you testing the code while it had the broken configure script that didn't set

Re: [HACKERS] random() in multi-threaded pgbench

2009-12-11 Thread Tom Lane
I wrote: Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes: http://www.kernel.org/doc/man-pages/online/pages/man3/random_r.3.html It only says that you need those if you want an *independent* random sequence for each thread. pgbench never had that before and I doubt we need it now. In

[HACKERS] random() in multi-threaded pgbench

2009-12-09 Thread Takahiro Itagaki
While testing the pgbench setshell command patch with -j option, I found all threads use the same sequence of random value. At first, I think we need to call srandom() in each thread, but the manual says we should use random_r() instead of random() on multi-threaded programs.