postgresql/src/include/postmaster
Thomas Munro 197e4af9d5 Refactor pid, random seed and start time initialization.
Background workers, including parallel workers, were generating
the same sequence of numbers in random().  This showed up as DSM
handle collisions when Parallel Hash created multiple segments,
but any code that calls random() in background workers could be
affected if it cares about different backends generating different
numbers.

Repair by making sure that all new processes initialize the seed
at the same time as they set MyProcPid and MyStartTime in a new
function InitProcessGlobals(), called by the postmaster, its
children and also standalone processes.  Also add a new high
resolution MyStartTimestamp as a potentially useful by-product,
and remove SessionStartTime from struct Port as it is now
redundant.

No back-patch for now, as the known consequences so far are just
a bunch of harmless shm_open(O_EXCL) collisions.

Author: Thomas Munro
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/CAEepm%3D2eJj_6%3DB%2B2tEpGu2nf1BjthCf9nXXUouYvJJ4C5WSwhg%40mail.gmail.com
2018-10-19 13:59:28 +13:00
..
autovacuum.h Log when a BRIN autosummarization request fails 2018-03-14 11:59:40 -03:00
bgworker.h Add comment explaining BGWORKER_BYPASS_ALLOWCONN 2018-04-23 10:31:22 +02:00
bgworker_internals.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
bgwriter.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
fork_process.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgarch.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster.h Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
startup.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
syslogger.h Implement "pg_ctl logrotate" command 2018-09-01 19:46:49 +03:00
walwriter.h Update copyright for 2018 2018-01-02 23:30:12 -05:00