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 обсуждение исходный текст |
Ответ на | Re: pgsql: Make pgbench use erand48() rather than random(). (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: pgsql: Make pgbench use erand48() rather than random().
|
Список | pgsql-committers |
Robert Haas <robertmhaas@gmail.com> writes: > On Wed, Aug 3, 2011 at 5:53 PM, Tom Lane <tgl@sss.pgh.pa.us> 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 по дате отправления: