1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Add shared_memory_type GUC.

Since 9.3 we have used anonymous shared mmap for our main shared memory
region, except in EXEC_BACKEND builds.  Provide a GUC so that users
can opt for System V shared memory once again, like in 9.2 and earlier.

A later patch proposes to add huge/large page support for AIX, which
requires System V shared memory and provided the motivation to revive
this possibility.  It may also be useful on some BSDs.

Author: Andres Freund (revived and documented by Thomas Munro)
Discussion: https://postgr.es/m/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com
Discussion: https://postgr.es/m/2AE143D2-87D3-4AD1-AC78-CE2258230C05%40FreeBSD.org
This commit is contained in:
Thomas Munro
2019-02-03 09:55:39 +01:00
parent 0d1fe9f74e
commit f1bebef60e
7 changed files with 101 additions and 33 deletions

View File

@ -453,6 +453,19 @@ const struct config_enum_entry ssl_protocol_versions_info[] = {
{NULL, 0, false}
};
static struct config_enum_entry shared_memory_options[] = {
#ifndef WIN32
{ "sysv", SHMEM_TYPE_SYSV, false},
#endif
#ifndef EXEC_BACKEND
{ "mmap", SHMEM_TYPE_MMAP, false},
#endif
#ifdef WIN32
{ "windows", SHMEM_TYPE_WINDOWS, false},
#endif
{NULL, 0, false}
};
/*
* Options for enum values stored in other modules
*/
@ -4327,6 +4340,16 @@ static struct config_enum ConfigureNamesEnum[] =
NULL, NULL, NULL
},
{
{"shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM,
gettext_noop("Selects the shared memory implementation used for the main shared memory region."),
NULL
},
&shared_memory_type,
DEFAULT_SHARED_MEMORY_TYPE, shared_memory_options,
NULL, NULL, NULL
},
{
{"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS,
gettext_noop("Selects the method used for forcing WAL updates to disk."),