Re: POSIX shared memory support

From: Chris Marcellino <cmarcellino(at)apple(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: POSIX shared memory support
Date: 2007-03-03 04:28:58
Message-ID: D9BA8B9B-A1CF-44E9-9F7A-B166875AEABB@apple.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

In case you haven't had enough, here is another version of the code
to make Postgres use POSIX shared memory. Along with the issues that
have already been addressed, this version ensures that orphaned
backends are not in the database when restarting Postgres by using a
single 1 byte SysV segment to see who is attached to the segment
using shmctl/IPC_STAT/nattach.

This effectively frees Postgres from the SHMMAX and SHMALL limits.
Since this still takes one SysV segment, SHMMNI can still be reached
on most platforms if a ton of databases are opened simultaneously
(i.e. 32 on Mac OS X, 256 on Linux and Solaris).

If you have the need to ship a product with Postgres embedded in it
and are unable to change kernel settings (like myself), this might be
of use to you. I have tested all of the failure situations I could
think of by various combinations of deleting lockfiles while in use,
changing the PID inside the lockfile and trying to restart and run
more than one postmaster simultaneously.

Of course, this since this requires both POSIX and SysV shared
memory, this doesn't increase the portability of Postgres which might
make it less appropriate for mass distribution; I thought I would put
it out there for any feedback either way.

Thanks again,
Chris Marcellino

Attachment Content-Type Size
posix_shmem.c application/octet-stream 18.8 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2007-03-03 07:00:26 resetStringInfo
Previous Message Bruce Momjian 2007-03-03 03:21:15 Re: cosmetic patch to large object regression test