Re: [PATCH 1/1] Initial mach based shared memory support. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH 1/1] Initial mach based shared memory support.
Date
Msg-id 455790.1611036731@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH 1/1] Initial mach based shared memory support.  (James Hilliard <james.hilliard1@gmail.com>)
Responses Re: [PATCH 1/1] Initial mach based shared memory support.  (James Hilliard <james.hilliard1@gmail.com>)
List pgsql-hackers
James Hilliard <james.hilliard1@gmail.com> writes:
> from my understanding due to mach semantics a number of the sanity checks
> we are doing for sysv shmem are probably unnecessary when using mach
> API's due to the mach port task bindings(mach_task_self()) effectively
> ensuring our maps are already task bound and won't conflict with other tasks.

Really?  If so, this whole patch is pretty much dead in the water,
because the fact that sysv shmem is globally accessible is exactly
why we use it (well, that and the fact that you can find out how many
processes are attached to it).  It's been a long time since we cared
about sysv shmem as a source of shared storage.  What we really use
it for is as a form of mutual exclusion, i.e. being able to detect
whether any live children remain from a dead postmaster.  That is,
PGSharedMemoryIsInUse is not some minor ancillary check, it's the main
reason this module exists at all.  If POSIX-style mmap'd shmem had the
same capability we'd likely have dropped sysv altogether long ago.

I've occasionally wondered if we should take another look at file locking
as a mechanism for ensuring only one postmaster+children process group
can access a data directory.  Back in the day it was too untrustworthy,
but maybe that has changed.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Next
From: Amit Kapila
Date:
Subject: Re: Parallel INSERT (INTO ... SELECT ...)