PostgreSQL in FreeBSD jails

Dag-Erling Smørgrav des at des.no
Mon May 2 14:48:34 PDT 2005


Richard Coleman <rcoleman at criticalmagic.com> writes:
> It might be easier to hack PostgreSQL so that the shared memory
> identifier depends not only on the port, but also on the IP address
> (which will of course be different for each jail).  Or better yet, to
> be able to specify the shared memory identifier to use directly in the
> config file.

That's not a sufficiently general solution.  First of all, in most
setups postgresql runs either a) without TCP/IP; b) only on 127.0.0.1;
c) on all interfaces.  Very rarely does it listen only on one single
identifiable IP address.  Therefore, relying on the IP address is
useless.  Besides, the shm id is an integer, which makes it difficult
to encode both the IP address and the port number without collisions.

The ideal solution is to use a type of shared memory that does not
need a namespace at all.

One option is to use a threads instead of child processes.  This would
require a major rewrite of the backend, and is not likely to happen
any time soon.

The other option is to add support for mmap()-based shared memory.  I
happen to have a patch, but testing it properly and getting it
approved and merged will take a while.

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-stable mailing list