pgsql: Avoid using PostmasterRandom() for DSM control segment ID.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid using PostmasterRandom() for DSM control segment ID.
Date: 2016-09-23 13:54:23
Message-ID: E1bnQvn-0007YR-Nj@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(dot)1474390434(at)sss(dot)pgh(dot)pa(dot)us>

Branch
------
REL9_6_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/b251379fb44b4893624999f1ba00986c029f11cf

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-09-23 14:10:03 pgsql: Don't trust CreateFileMapping() to clear the error code on succe
Previous Message Peter Eisentraut 2016-09-23 13:09:21 pgsql: pg_ctl: Add promote wait option to help output