diff options
| author | Thomas Munro | 2018-10-19 00:59:14 +0000 |
|---|---|---|
| committer | Thomas Munro | 2018-10-19 00:59:28 +0000 |
| commit | 197e4af9d5da180190a0f2be851b095dba57d9cd (patch) | |
| tree | 4121b3b50a5f020f982eb4cbbe754420d200ff31 /src/include/libpq | |
| parent | e74dd00f53cd6dc1887f76b9672e5f6dcf0fd8a2 (diff) | |
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
Diffstat (limited to 'src/include/libpq')
| -rw-r--r-- | src/include/libpq/libpq-be.h | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index eb8bba4ed88..b2c59df54e4 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -151,13 +151,6 @@ typedef struct Port HbaLine *hba; /* - * Information that really has no business at all being in struct Port, - * but since it gets used by elog.c in the same way as database_name and - * other members of this struct, we may as well keep it here. - */ - TimestampTz SessionStartTime; /* backend start time */ - - /* * TCP keepalive settings. * * default values are 0 if AF_UNIX or not yet known; current values are 0 |
