]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid using PostmasterRandom() for DSM control segment ID.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Sep 2016 13:54:11 +0000 (09:54 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 23 Sep 2016 13:54:11 +0000 (09:54 -0400)
commit32cdf680f19a3c995da83cbef2741288b0549a7d
treec63a8716e44db23cc5a18e38b27e9657ba7ebab9
parentd3dd00e675712da13262149b3478ecbff91525fd
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>
src/backend/postmaster/postmaster.c
src/backend/storage/ipc/dsm.c
src/include/postmaster/postmaster.h