Re: Weaker shmem interlock w/o postmaster.pid

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Noah Misch <noah@leadboat.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2013-09-11T18:10:45Z
Lists: pgsql-hackers
On Tue, Sep 10, 2013 at 11:33 PM, Noah Misch <noah@leadboat.com> wrote:
> I'm thinking to preserve postmaster.pid at immediate shutdown in all released
> versions, but I'm less sure about back-patching a change to make
> PGSharedMemoryCreate() pickier.  On the one hand, allowing startup to proceed
> with backends still active in the same data directory is a corruption hazard.
> On the other hand, it could break weird shutdown/restart patterns that permit
> trivial lifespan overlap between backends of different postmasters.  Opinions?

I'm more sanguine about the second change than the first.  Leaving
postmaster.pid around seems like a clear user-visible behavior change
that could break user scripts or have other consequences that we don't
foresee; thus, I would vote against back-patching it.  Indeed, I'm not
sure it's a good idea to do that even in master.  On the other hand,
tightening the checks in PGSharedMemoryCreate() seems very much worth
doing, and I think it might also be safe enough to back-patch.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Commits

  1. Probe only 127.0.0.1 when looking for ports on Unix.

  2. Don't write to stdin of a test process that could have already exited.

  3. Test both 0.0.0.0 and 127.0.0.x addresses to find a usable port.

  4. MSYS: Translate REGRESS_SHLIB to a Windows file name.

  5. MSYS: Skip src/test/recovery/t/017_shm.pl.

  6. When Perl "kill(9, ...)" fails, try "pg_ctl kill".

  7. Consistently test for in-use shared memory.

  8. Revert "Consistently test for in-use shared memory."

  9. Silence -Wimplicit-fallthrough in sysv_shmem.c.

  10. Make src/test/recovery/t/017_shm.pl safe for concurrent execution.

  11. Update HINT for pre-existing shared memory block.

  12. Add WL_EXIT_ON_PM_DEATH pseudo-event.

  13. The default values for shared_buffers and max_connections are now 1000

  14. XLOG (and related) changes:

  15. Significant cleanups in SysV IPC handling (shared mem and semaphores).