pgsql: Arrange to generate different random sequences in the different

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Arrange to generate different random sequences in the different
Date: 2009-12-11 21:50:06
Message-ID: 20091211215006.8577B753FB7@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
Arrange to generate different random sequences in the different child
processes of a pgbench run, when we are using -j > 1 and are emulating
threads via fork(). Otherwise the children all inherit the same random
sequence state and produce the same random-number sequence.

In the threaded case the different threads will share one RNG state, so
they will produce different subsets of one sequence, which is maybe more
correlated than a purist would like but will not be "the same". So we
leave that case alone.

First noticed by Takahiro Itagaki, and is also part of the explanation
for the pgbench misbehavior recently reported by Jaime Casanova.

Modified Files:
--------------
pgsql/contrib/pgbench:
pgbench.c (r1.91 -> r1.92)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/pgbench/pgbench.c?r1=1.91&r2=1.92)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2009-12-12 00:35:34 pgsql: Export ExplainBeginOutput() and ExplainEndOutput() for
Previous Message User Fxjr 2009-12-11 20:24:03 npgsql - Npgsql2: Bug: Money to Decimal conversion.