postgresql/src/include
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
..
access Move generic slot support functions from heaptuple.c into execTuples.c. 2018-10-15 15:17:04 -07:00
bootstrap Rationalize handling of array type names in bootstrap data. 2018-04-17 18:29:11 -04:00
catalog Correct constness of system attributes in heap.c & prerequisites. 2018-10-16 09:44:43 -07:00
commands Turn transaction_isolation into GUC enum 2018-10-09 21:26:00 +02:00
common Add application_name to connection authorized msg 2018-09-28 19:04:50 -04:00
datatype Update copyright for 2018 2018-01-02 23:30:12 -05:00
executor Move TupleTableSlots boolean member into one flag variable. 2018-10-15 18:23:25 -07:00
fe_utils Add semicolons to end of internally run queries 2018-08-30 19:23:22 +02:00
foreign Allow insert and update tuple routing and COPY for foreign tables. 2018-04-06 19:22:03 -04:00
jit Collect JIT instrumentation from workers. 2018-09-25 13:12:44 -07:00
lib Code review for simplehash.h. 2018-08-28 12:32:22 +12:00
libpq Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
mb Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
nodes Improve some comments related to executor result relations. 2018-10-17 16:41:00 -04:00
optimizer Remove some unnecessary fields from Plan trees. 2018-10-07 14:33:17 -04:00
parser Correct constness of system attributes in heap.c & prerequisites. 2018-10-16 09:44:43 -07:00
partitioning Centralize executor's opening/closing of Relations for rangetable entries. 2018-10-04 14:03:42 -04:00
port Convert elog.c's useful_strerror() into a globally-used strerror wrapper. 2018-09-26 11:06:42 -04:00
portability Update copyright for 2018 2018-01-02 23:30:12 -05:00
postmaster Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
regex Update copyright for 2018 2018-01-02 23:30:12 -05:00
replication Fix memory leak in TRUNCATE decoding 2018-09-03 02:10:24 +02:00
rewrite Revert MERGE patch 2018-04-12 11:22:56 +01:00
snowball Sync our Snowball stemmer dictionaries with current upstream. 2018-09-24 17:29:38 -04:00
statistics Update copyright for 2018 2018-01-02 23:30:12 -05:00
storage Correct constness of a few variables. 2018-10-15 21:01:14 -07:00
tcop Fix event triggers for partitioned tables 2018-10-06 19:17:46 -03:00
tsearch Post-feature-freeze pgindent run. 2018-04-26 14:47:16 -04:00
utils Reorder FmgrBuiltin members, saving 25% in size. 2018-10-16 14:51:18 -07:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Add macro to cast away const without allowing changes to underlying type. 2018-10-16 12:05:50 -07:00
fmgr.h Add expression compilation support to LLVM JIT provider. 2018-03-22 14:45:59 -07:00
funcapi.h Clean up in the wake of TupleDescGetSlot() removal / 10763358c3. 2018-09-27 11:38:11 -07:00
getaddrinfo.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
getopt_long.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
miscadmin.h Refactor pid, random seed and start time initialization. 2018-10-19 13:59:28 +13:00
pg_config.h.in Select appropriate PG_PRINTF_ATTRIBUTE for recent NetBSD. 2018-10-09 11:10:07 -04:00
pg_config.h.win32 Make assorted performance improvements in snprintf.c. 2018-10-03 10:18:15 -04:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Improve error reporting for unsupported effective_io_concurrency setting. 2018-09-28 16:12:13 -04:00
pg_getopt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_trace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgstat.h Add wait event for fsync of WAL segments 2018-07-02 22:19:46 +09:00
pgtar.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgtime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
port.h Fix omissions in snprintf.c's coverage of standard *printf functions. 2018-10-08 19:15:55 -04:00
postgres.h Detoast plpgsql variables if they might live across a transaction boundary. 2018-05-16 14:56:52 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rusagestub.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
windowapi.h Update copyright for 2018 2018-01-02 23:30:12 -05:00