Re: Issue with the PRNG used by Postgres

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Issue with the PRNG used by Postgres
Дата
Msg-id CA+TgmoatnT0WM1nQoBFG5S462ESHrL9NZk4jg4jg6KVW6OBb-Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Issue with the PRNG used by Postgres  (Andres Freund <andres@anarazel.de>)
Ответы Re: Issue with the PRNG used by Postgres  (Parag Paul <parag.paul@gmail.com>)
Re: Issue with the PRNG used by Postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, Apr 9, 2024 at 5:05 PM Andres Freund <andres@anarazel.de> wrote:
> ISTM that the fix here is to not use a spinlock for whatever the contention is
> on, rather than improve the RNG.

I'm not convinced that we should try to improve the RNG, but surely we
need to put parentheses around pg_prng_double(&pg_global_prng_state) +
0.5. IIUC, the current logic is making us multiply the spin delay by a
value between 0 and 1 when what was intended was that it should be
multiplied by a value between 0.5 and 1.5.

If I'm reading this correctly, this was introduced here:

commit 59bb147353ba274e0836d06f429176d4be47452c
Author: Bruce Momjian <bruce@momjian.us>
Date:   Fri Feb 3 12:45:47 2006 +0000

    Update random() usage so ranges are inclusive/exclusive as required.

--
Robert Haas
EDB: http://www.enterprisedb.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ants Aasma
Дата:
Сообщение: Re: PostgreSQL 17 Release Management Team & Feature Freeze
Следующее
От: Parag Paul
Дата:
Сообщение: Re: Issue with the PRNG used by Postgres