postgresql/src/backend/storage
Noah Misch c098509927 Consistently test for in-use shared memory.
postmaster startup scrutinizes any shared memory segment recorded in
postmaster.pid, exiting if that segment matches the current data
directory and has an attached process.  When the postmaster.pid file was
missing, a starting postmaster used weaker checks.  Change to use the
same checks in both scenarios.  This increases the chance of a startup
failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1
postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster
will no longer stop if shmat() of an old segment fails with EACCES.  A
postmaster will no longer recycle segments pertaining to other data
directories.  That's good for production, but it's bad for integration
tests that crash a postmaster and immediately delete its data directory.
Such a test now leaks a segment indefinitely.  No "make check-world"
test does that.  win32_shmem.c already avoided all these problems.  In
9.6 and later, enhance PostgresNode to facilitate testing.  Back-patch
to 9.4 (all supported versions).

Reviewed (in earlier versions) by Daniel Gustafsson and Kyotaro HORIGUCHI.

Discussion: https://postgr.es/m/20190408064141.GA2016666@rfd.leadboat.com
2019-04-12 22:36:38 -07:00
..
buffer Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00
file Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
freespace Improve code comments in b0eaa4c51b. 2019-03-16 06:55:56 +05:30
ipc Consistently test for in-use shared memory. 2019-04-12 22:36:38 -07:00
large_object Remove superfluous tqual.h includes. 2019-01-21 12:15:02 -08:00
lmgr Prevent use of uninitialized variable 2019-04-02 16:03:26 -03:00
page Track block level checksum failures in pg_stat_database 2019-03-09 10:47:30 -08:00
smgr Fix bugs in mdsyncfiletag(). 2019-04-05 17:41:58 +13:00
sync Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00
Makefile Refactor the fsync queue for wider use. 2019-04-04 23:38:38 +13:00