pgsql: Avoid using PostmasterRandom() for DSM control segment ID. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid using PostmasterRandom() for DSM control segment ID.
Date
Msg-id E1bnQvn-0007YU-Np@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Avoid using PostmasterRandom() for DSM control segment ID.

Commits 470d886c3 et al intended to fix the problem that the postmaster
selected the same "random" DSM control segment ID on every start.  But
using PostmasterRandom() for that destroys the intended property that the
delay between random_start_time and random_stop_time will be unpredictable.
(Said delay is probably already more predictable than we could wish, but
that doesn't mean that reducing it by a couple orders of magnitude is OK.)
Revert the previous patch and add a comment warning against misuse of
PostmasterRandom.  Fix the original problem by calling srandom() early in
PostmasterMain, using a low-security seed that will later be overwritten
by PostmasterRandom.

Discussion: <20789.1474390434@sss.pgh.pa.us>

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/32cdf680f19a3c995da83cbef2741288b0549a7d

Modified Files
--------------
src/backend/postmaster/postmaster.c | 17 ++++++++++++++++-
src/backend/storage/ipc/dsm.c       |  3 +--
src/include/postmaster/postmaster.h |  1 -
3 files changed, 17 insertions(+), 4 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid using PostmasterRandom() for DSM control segment ID.
Next
From: Tom Lane
Date:
Subject: pgsql: Avoid using PostmasterRandom() for DSM control segment ID.