Re: pgsql: Make pgbench use erand48() rather than random().
От
Tom Lane
Тема
Re: pgsql: Make pgbench use erand48() rather than random().
Дата
Msg-id
24981.1312411016@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
pgsql: Make pgbench use erand48() rather than random(). Robert Haas <rhaas@postgresql.org>
Re: pgsql: Make pgbench use erand48() rather than random(). Tom Lane <tgl@sss.pgh.pa.us>
Re: pgsql: Make pgbench use erand48() rather than random(). Robert Haas <robertmhaas@gmail.com>
Re: pgsql: Make pgbench use erand48() rather than random(). Tom Lane <tgl@sss.pgh.pa.us>
Re: pgsql: Make pgbench use erand48() rather than random(). Robert Haas <robertmhaas@gmail.com>
Robert Haas writes: > On Wed, Aug 3, 2011 at 5:53 PM, Tom Lane wrote: >> Hmm. I find the pgbench part of this a bit questionable, specifically >> your decision to remove the code around line 2590 that installed a >> variable srandom() seed in child processes. > Unless I'm asleep at the switch, the srandom() calls you're worrying > about execute in the parent thread, which still makes its own call to > srandom(). [ looks more closely... ] OK, you're right: the per-"thread" random seeds are initialized in the parent process and then propagated to child processes by fork(); we'll never call random() in the children so there's no need to make their states diverge. Never mind. I do however notice a vestigial reference to MAX_RANDOM_VALUE at line 1063, which we probably should get rid of. What I think we probably need instead, and don't have, is a check that "max - min + 1" doesn't overflow. regards, tom lane
В списке pgsql-committers по дате отправления
От: Robert Haas
Дата:
От: Robert Haas
Дата: