agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v7 3/4] Add documentation for ALTER SUBSCRIPTION...ADD/DROP PUBLICATION 8+ messages / 2 participants [nested] [flat]
* [PATCH v7 3/4] Add documentation for ALTER SUBSCRIPTION...ADD/DROP PUBLICATION @ 2021-02-16 01:51 Bharath Rupireddy <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Bharath Rupireddy @ 2021-02-16 01:51 UTC (permalink / raw) --- doc/src/sgml/ref/alter_subscription.sgml | 65 ++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml index 0adf68ecca..aa181b94c5 100644 --- a/doc/src/sgml/ref/alter_subscription.sgml +++ b/doc/src/sgml/ref/alter_subscription.sgml @@ -23,6 +23,8 @@ PostgreSQL documentation <synopsis> ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> CONNECTION '<replaceable>conninfo</replaceable>' ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">set_publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ] +ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ADD PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">set_publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ] +ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DROP PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">set_publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ] ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> REFRESH PUBLICATION [ WITH ( <replaceable class="parameter">refresh_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ] ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ENABLE ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DISABLE @@ -125,6 +127,69 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO < </listitem> </varlistentry> + <varlistentry> + <term><literal>ADD PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term> + <listitem> + <para> + Add list of publications to subscription. See + <xref linkend="sql-createsubscription"/> for more information. + By default this command will also act like <literal>REFRESH + PUBLICATION</literal>, except it only affect on added publications. + </para> + + <para> + <replaceable>set_publication_option</replaceable> specifies additional + options for this operation. The supported options are: + + <variablelist> + <varlistentry> + <term><literal>refresh</literal> (<type>boolean</type>)</term> + <listitem> + <para> + When false, the command will not try to refresh table information. + <literal>REFRESH PUBLICATION</literal> should then be executed separately. + The default is <literal>true</literal>. + </para> + </listitem> + </varlistentry> + </variablelist> + + Additionally, refresh options as described + under <literal>REFRESH PUBLICATION</literal> may be specified. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><literal>DROP PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term> + <listitem> + <para> + Drop list of publications from subscription. See + <xref linkend="sql-createsubscription"/> for more information. + By default this command will also act like <literal>REFRESH + PUBLICATION</literal>, except it only affect on dropped publications. + </para> + + <para> + <replaceable>set_publication_option</replaceable> specifies additional + options for this operation. The supported options are: + + <variablelist> + <varlistentry> + <term><literal>refresh</literal> (<type>boolean</type>)</term> + <listitem> + <para> + When false, the command will not try to refresh table information. + <literal>REFRESH PUBLICATION</literal> should then be executed separately. + The default is <literal>true</literal>. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </listitem> + </varlistentry> + <varlistentry> <term><literal>REFRESH PUBLICATION</literal></term> <listitem> -- 2.25.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=v7-0004-Add-tab-complete-for-ALTER-SUBSCRIPTION.ADD-DROP.patch ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v3] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. https://www.postgresql.org/message-id/flat/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.... --- doc/src/sgml/config.sgml | 17 ++++++++++++++++- src/backend/port/sysv_shmem.c | 3 +++ src/backend/port/win32_shmem.c | 4 ++++ src/backend/utils/misc/guc_tables.c | 12 ++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 8c56b134a84..3770c7dc254 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1700,23 +1700,24 @@ include_dir 'conf.d' </indexterm> </term> <listitem> <para> Controls whether huge pages are requested for the main shared memory area. Valid values are <literal>try</literal> (the default), <literal>on</literal>, and <literal>off</literal>. With <varname>huge_pages</varname> set to <literal>try</literal>, the server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-active"/>. </para> <para> At present, this setting is supported only on Linux and Windows. The setting is ignored on other systems when set to <literal>try</literal>. On Linux, it is only supported when <varname>shared_memory_type</varname> is set to <literal>mmap</literal> (the default). </para> <para> @@ -10679,22 +10680,36 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' with assertions enabled. That is the case if the macro <symbol>USE_ASSERT_CHECKING</symbol> is defined when <productname>PostgreSQL</productname> is built (accomplished e.g., by the <command>configure</command> option <option>--enable-cassert</option>). By default <productname>PostgreSQL</productname> is built without assertions. </para> </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-active" xreflabel="huge_pages_active"> + <term><varname>huge_pages_active</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>huge_pages_active</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports whether huge pages are in use by the current process. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> <primary><varname>integer_datetimes</varname> configuration parameter</primary> </indexterm> </term> <listitem> <para> Reports whether <productname>PostgreSQL</productname> was built with support for 64-bit-integer dates and times. As of <productname>PostgreSQL</productname> 10, this is always <literal>on</literal>. diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..48ead4d27bf 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -619,22 +619,25 @@ CreateAnonymousSegment(Size *size) allocsize += hugepagesize - (allocsize % hugepagesize); ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS | mmap_flags, -1, 0); mmap_errno = errno; if (huge_pages == HUGE_PAGES_TRY && ptr == MAP_FAILED) elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m", allocsize); } #endif + SetConfigOption("huge_pages_active", ptr == MAP_FAILED ? "off" : "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + if (ptr == MAP_FAILED && huge_pages != HUGE_PAGES_ON) { /* * Use the original size, not the rounded-up value, when falling back * to non-huge pages. */ allocsize = *size; ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS, -1, 0); mmap_errno = errno; } diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..0bf594c8bf9 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -319,22 +319,26 @@ retry: * If the segment already existed, CreateFileMapping() will return a * handle to the existing one and set ERROR_ALREADY_EXISTS. */ if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hmap); /* Close the handle, since we got a valid one * to the previous segment. */ hmap = NULL; Sleep(1000); continue; } + + SetConfigOption("huge_pages_active", (flProtect & SEC_LARGE_PAGES) ? + "on" : "off", PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + break; } /* * If the last call in the loop still returned ERROR_ALREADY_EXISTS, this * shared memory segment exists and we assume it belongs to somebody else. */ if (!hmap) ereport(FATAL, (errmsg("pre-existing shared memory block is still in use"), errhint("Check if there are any old server processes still running, and terminate them."))); diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index b21698934c8..1a298f16c81 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -554,22 +554,23 @@ static int server_version_num; #define DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 #else #define DEFAULT_SYSLOG_FACILITY 0 #endif static int syslog_facility = DEFAULT_SYSLOG_FACILITY; static char *timezone_string; static char *log_timezone_string; static char *timezone_abbreviations_string; static char *data_directory; static char *session_authorization_string; +static char *huge_pages_active = "unknown"; /* dynamically set */ static int max_function_args; static int max_index_keys; static int max_identifier_length; static int block_size; static int segment_size; static int shared_memory_size_mb; static int shared_memory_size_in_huge_pages; static int wal_block_size; static bool data_checksums; static bool integer_datetimes; @@ -4516,22 +4517,33 @@ struct config_string ConfigureNamesString[] = { {"backtrace_functions", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Log backtrace for errors in these functions."), NULL, GUC_NOT_IN_SAMPLE }, &backtrace_functions, "", check_backtrace_functions, assign_backtrace_functions, NULL }, + { + {"huge_pages_active", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates whether huge pages are in use."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED + }, + &huge_pages_active, + "unknown", + NULL, NULL, NULL + }, + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL } }; struct config_enum ConfigureNamesEnum[] = { { {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, -- 2.34.1 --uWbmMdDzzl2TXAgx-- ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. --- doc/src/sgml/config.sgml | 17 ++++++++++++++++- src/backend/port/sysv_shmem.c | 12 +++++++++--- src/backend/port/win32_shmem.c | 4 ++++ src/backend/utils/misc/guc_tables.c | 13 +++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index f985afc009d..e5ef58d441d 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1708,7 +1708,8 @@ include_dir 'conf.d' server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-active"/>. </para> <para> @@ -10687,6 +10688,20 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-active" xreflabel="huge_pages_active"> + <term><varname>huge_pages_active</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>huge_pages_active</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports whether huge pages are in use by the current process. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..62029e7fe0e 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -621,9 +621,15 @@ CreateAnonymousSegment(Size *size) ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS | mmap_flags, -1, 0); mmap_errno = errno; - if (huge_pages == HUGE_PAGES_TRY && ptr == MAP_FAILED) - elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m", - allocsize); + if (huge_pages == HUGE_PAGES_TRY) + { + if (ptr == MAP_FAILED) + elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m", + allocsize); + else + SetConfigOption("huge_pages_active", "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + } } #endif diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..352e68b7af2 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -314,6 +314,10 @@ retry: errdetail("Failed system call was CreateFileMapping(size=%zu, name=%s).", size, szShareMem))); } + else if (huge_pages == HUGE_PAGES_TRY) + SetConfigOption("huge_pages_active", "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + /* * If the segment already existed, CreateFileMapping() will return a diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 4454d57322a..649aa473020 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -571,6 +571,7 @@ static int shared_memory_size_mb; static int shared_memory_size_in_huge_pages; static int wal_block_size; static bool data_checksums; +static bool huge_pages_active = false; /* dynamically set */ static bool integer_datetimes; #ifdef USE_ASSERT_CHECKING @@ -1013,6 +1014,18 @@ struct config_bool ConfigureNamesBool[] = true, NULL, NULL, NULL }, + + { + {"huge_pages_active", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates whether huge pages are in use."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED + }, + &huge_pages_active, + false, + NULL, NULL, NULL + }, + { /* Not for general use --- used by SET SESSION AUTHORIZATION */ {"is_superuser", PGC_INTERNAL, UNGROUPED, -- 2.25.1 --kfjH4zxOES6UT95V-- ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v7] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. https://www.postgresql.org/message-id/flat/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.... --- doc/src/sgml/config.sgml | 21 ++++++++++++++++++++- src/backend/port/sysv_shmem.c | 7 +++++++ src/backend/port/win32_shmem.c | 4 ++++ src/backend/storage/ipc/ipci.c | 2 ++ src/backend/utils/misc/guc_tables.c | 20 ++++++++++++++++++++ src/include/storage/pg_shmem.h | 5 +++-- 6 files changed, 56 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 096be7cb8cc..de74d3d1a81 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1728,7 +1728,8 @@ include_dir 'conf.d' server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-status"/>. </para> <para> @@ -10710,6 +10711,24 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status"> + <term><varname>huge_pages_status</varname> (<type>enum</type>) + <indexterm> + <primary><varname>huge_pages_status</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports the state of huge pages in the current instance: + <literal>on</literal>, <literal>off</literal>, or (if displayed with + <literal>postgres -C</literal>) <literal>unknown</literal>. + This parameter is useful to determine whether allocation of huge pages + was successful when <literal>huge_pages=try</literal>. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..a958f75f7a4 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -627,6 +627,9 @@ CreateAnonymousSegment(Size *size) } #endif + SetConfigOption("huge_pages_status", ptr == MAP_FAILED ? "off" : "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + if (ptr == MAP_FAILED && huge_pages != HUGE_PAGES_ON) { /* @@ -737,7 +740,11 @@ PGSharedMemoryCreate(Size size, sysvsize = sizeof(PGShmemHeader); } else + { sysvsize = size; + SetConfigOption("huge_pages_status", "off", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + } /* * Loop till we find a free IPC key. Trust CreateDataDirLockFile() to diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..199f2e23a13 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -327,6 +327,10 @@ retry: Sleep(1000); continue; } + + SetConfigOption("huge_pages_status", (flProtect & SEC_LARGE_PAGES) ? + "on" : "off", PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + break; } diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 8f1ded7338f..f760675691a 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -190,6 +190,8 @@ CreateSharedMemoryAndSemaphores(void) */ seghdr = PGSharedMemoryCreate(size, &shim); + Assert(strcmp("unknown", GetConfigOption("huge_pages_status", false, false)) != 0); + InitShmemAccess(seghdr); /* diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 0a399afa8ca..a6b7fd28e68 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -366,6 +366,13 @@ static const struct config_enum_entry huge_pages_options[] = { {NULL, 0, false} }; +static const struct config_enum_entry huge_pages_status_options[] = { + {"off", HUGE_PAGES_OFF, false}, + {"on", HUGE_PAGES_ON, false}, + {"unknown", HUGE_PAGES_UNKNOWN, false}, + {NULL, 0, false} +}; + static const struct config_enum_entry recovery_prefetch_options[] = { {"off", RECOVERY_PREFETCH_OFF, false}, {"on", RECOVERY_PREFETCH_ON, false}, @@ -554,6 +561,8 @@ int ssl_renegotiation_limit; int huge_pages = HUGE_PAGES_TRY; int huge_page_size; +int huge_pages_status = HUGE_PAGES_UNKNOWN; + /* * These variables are all dummies that don't do anything, except in some * cases provide the value for SHOW to display. The real state is elsewhere @@ -4889,6 +4898,17 @@ struct config_enum ConfigureNamesEnum[] = NULL, NULL, NULL }, + { + {"huge_pages_status", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates the status of huge pages."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + }, + &huge_pages_status, + HUGE_PAGES_UNKNOWN, huge_pages_status_options, + NULL, NULL, NULL + }, + { {"recovery_prefetch", PGC_SIGHUP, WAL_RECOVERY, gettext_noop("Prefetch referenced blocks during recovery."), diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h index 4dd05f156d5..bfda42b0b26 100644 --- a/src/include/storage/pg_shmem.h +++ b/src/include/storage/pg_shmem.h @@ -46,12 +46,13 @@ extern PGDLLIMPORT int shared_memory_type; extern PGDLLIMPORT int huge_pages; extern PGDLLIMPORT int huge_page_size; -/* Possible values for huge_pages */ +/* Possible values for huge_pages/huge_pages_status */ typedef enum { HUGE_PAGES_OFF, HUGE_PAGES_ON, - HUGE_PAGES_TRY + HUGE_PAGES_TRY, /* only for huge_pages */ + HUGE_PAGES_UNKNOWN /* only for huge_pages_status */ } HugePagesType; /* Possible values for shared_memory_type */ -- 2.34.1 --PELMulVtG1KW7XV6-- ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v8] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. https://www.postgresql.org/message-id/flat/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.... --- doc/src/sgml/config.sgml | 21 ++++++++++++++++++++- src/backend/port/sysv_shmem.c | 10 ++++++++++ src/backend/port/win32_shmem.c | 5 +++++ src/backend/storage/ipc/ipci.c | 7 +++++++ src/backend/utils/misc/guc_tables.c | 20 ++++++++++++++++++++ src/include/storage/pg_shmem.h | 5 +++-- 6 files changed, 65 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 6262cb7bb2f..e69afae71bf 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1727,7 +1727,8 @@ include_dir 'conf.d' server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-status"/>. </para> <para> @@ -10738,6 +10739,24 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status"> + <term><varname>huge_pages_status</varname> (<type>enum</type>) + <indexterm> + <primary><varname>huge_pages_status</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports the state of huge pages in the current instance: + <literal>on</literal>, <literal>off</literal>, or (if displayed with + <literal>postgres -C</literal>) <literal>unknown</literal>. + This parameter is useful to determine whether allocation of huge pages + was successful when <literal>huge_pages=try</literal>. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..0e710237ea1 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -627,6 +627,10 @@ CreateAnonymousSegment(Size *size) } #endif + /* Report whether huge pages are in use */ + SetConfigOption("huge_pages_status", ptr == MAP_FAILED ? "off" : "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + if (ptr == MAP_FAILED && huge_pages != HUGE_PAGES_ON) { /* @@ -737,8 +741,14 @@ PGSharedMemoryCreate(Size size, sysvsize = sizeof(PGShmemHeader); } else + { sysvsize = size; + /* huge pages are only available with mmap */ + SetConfigOption("huge_pages_status", "off", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + } + /* * Loop till we find a free IPC key. Trust CreateDataDirLockFile() to * ensure no more than one postmaster per data directory can enter this diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..87f0b001915 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -327,6 +327,11 @@ retry: Sleep(1000); continue; } + + /* Report whether huge pages are in use */ + SetConfigOption("huge_pages_status", (flProtect & SEC_LARGE_PAGES) ? + "on" : "off", PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + break; } diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 8f1ded7338f..5901a3bd8eb 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -190,6 +190,13 @@ CreateSharedMemoryAndSemaphores(void) */ seghdr = PGSharedMemoryCreate(size, &shim); + /* + * Make sure that huge pages are never reported as "unknown" + * while the server is running. + */ + Assert(strcmp("unknown", + GetConfigOption("huge_pages_status", false, false)) != 0); + InitShmemAccess(seghdr); /* diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 977027ec8cb..37a97696dd5 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -365,6 +365,13 @@ static const struct config_enum_entry huge_pages_options[] = { {NULL, 0, false} }; +static const struct config_enum_entry huge_pages_status_options[] = { + {"off", HUGE_PAGES_OFF, false}, + {"on", HUGE_PAGES_ON, false}, + {"unknown", HUGE_PAGES_UNKNOWN, false}, + {NULL, 0, false} +}; + static const struct config_enum_entry recovery_prefetch_options[] = { {"off", RECOVERY_PREFETCH_OFF, false}, {"on", RECOVERY_PREFETCH_ON, false}, @@ -551,6 +558,8 @@ int ssl_renegotiation_limit; int huge_pages = HUGE_PAGES_TRY; int huge_page_size; +int huge_pages_status = HUGE_PAGES_UNKNOWN; + /* * These variables are all dummies that don't do anything, except in some * cases provide the value for SHOW to display. The real state is elsewhere @@ -4893,6 +4902,17 @@ struct config_enum ConfigureNamesEnum[] = NULL, NULL, NULL }, + { + {"huge_pages_status", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates the status of huge pages."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + }, + &huge_pages_status, + HUGE_PAGES_UNKNOWN, huge_pages_status_options, + NULL, NULL, NULL + }, + { {"recovery_prefetch", PGC_SIGHUP, WAL_RECOVERY, gettext_noop("Prefetch referenced blocks during recovery."), diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h index 4dd05f156d5..bfda42b0b26 100644 --- a/src/include/storage/pg_shmem.h +++ b/src/include/storage/pg_shmem.h @@ -46,12 +46,13 @@ extern PGDLLIMPORT int shared_memory_type; extern PGDLLIMPORT int huge_pages; extern PGDLLIMPORT int huge_page_size; -/* Possible values for huge_pages */ +/* Possible values for huge_pages/huge_pages_status */ typedef enum { HUGE_PAGES_OFF, HUGE_PAGES_ON, - HUGE_PAGES_TRY + HUGE_PAGES_TRY, /* only for huge_pages */ + HUGE_PAGES_UNKNOWN /* only for huge_pages_status */ } HugePagesType; /* Possible values for shared_memory_type */ -- 2.34.1 --VHnddftIsH1nzTLp-- ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v2] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. --- doc/src/sgml/config.sgml | 17 ++++++++++++++++- src/backend/port/sysv_shmem.c | 5 ++++- src/backend/port/win32_shmem.c | 5 ++++- src/backend/utils/misc/guc_tables.c | 13 +++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index d190be1925d..fcef4e3ce8e 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1708,7 +1708,8 @@ include_dir 'conf.d' server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-active"/>. </para> <para> @@ -10687,6 +10688,20 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-active" xreflabel="huge_pages_active"> + <term><varname>huge_pages_active</varname> (<type>boolean</type>) + <indexterm> + <primary><varname>huge_pages_active</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports whether huge pages are in use by the current process. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..9b9b25d53ba 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -621,7 +621,10 @@ CreateAnonymousSegment(Size *size) ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS | mmap_flags, -1, 0); mmap_errno = errno; - if (huge_pages == HUGE_PAGES_TRY && ptr == MAP_FAILED) + if (ptr != MAP_FAILED) + SetConfigOption("huge_pages_active", "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + else if (huge_pages == HUGE_PAGES_TRY) elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m", allocsize); } diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..73472a18f25 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -290,7 +290,10 @@ retry: size_low, /* Size Lower 32 bits */ szShareMem); - if (!hmap) + if (hmap) + SetConfigOption("huge_pages_active", "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + else { if (GetLastError() == ERROR_NO_SYSTEM_RESOURCES && huge_pages == HUGE_PAGES_TRY && diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index b21698934c8..1e8e67a4c54 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -571,6 +571,7 @@ static int shared_memory_size_mb; static int shared_memory_size_in_huge_pages; static int wal_block_size; static bool data_checksums; +static bool huge_pages_active = false; /* dynamically set */ static bool integer_datetimes; #ifdef USE_ASSERT_CHECKING @@ -1013,6 +1014,18 @@ struct config_bool ConfigureNamesBool[] = true, NULL, NULL, NULL }, + + { + {"huge_pages_active", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates whether huge pages are in use."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED + }, + &huge_pages_active, + false, + NULL, NULL, NULL + }, + { /* Not for general use --- used by SET SESSION AUTHORIZATION */ {"is_superuser", PGC_INTERNAL, UNGROUPED, -- 2.25.1 --LQAwcd5tHl0Qlnzi-- ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v4 1/2] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. https://www.postgresql.org/message-id/flat/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.... --- doc/src/sgml/config.sgml | 17 ++++++++++++++++- src/backend/port/sysv_shmem.c | 3 +++ src/backend/port/win32_shmem.c | 4 ++++ src/backend/utils/misc/guc_tables.c | 12 ++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 8c56b134a84..3ff301edf8a 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1700,23 +1700,24 @@ include_dir 'conf.d' </indexterm> </term> <listitem> <para> Controls whether huge pages are requested for the main shared memory area. Valid values are <literal>try</literal> (the default), <literal>on</literal>, and <literal>off</literal>. With <varname>huge_pages</varname> set to <literal>try</literal>, the server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-active"/>. </para> <para> At present, this setting is supported only on Linux and Windows. The setting is ignored on other systems when set to <literal>try</literal>. On Linux, it is only supported when <varname>shared_memory_type</varname> is set to <literal>mmap</literal> (the default). </para> <para> @@ -10679,22 +10680,36 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' with assertions enabled. That is the case if the macro <symbol>USE_ASSERT_CHECKING</symbol> is defined when <productname>PostgreSQL</productname> is built (accomplished e.g., by the <command>configure</command> option <option>--enable-cassert</option>). By default <productname>PostgreSQL</productname> is built without assertions. </para> </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-active" xreflabel="huge_pages_active"> + <term><varname>huge_pages_active</varname> (<type>string</type>) + <indexterm> + <primary><varname>huge_pages_active</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports whether huge pages are in use by the current instance. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> <primary><varname>integer_datetimes</varname> configuration parameter</primary> </indexterm> </term> <listitem> <para> Reports whether <productname>PostgreSQL</productname> was built with support for 64-bit-integer dates and times. As of <productname>PostgreSQL</productname> 10, this is always <literal>on</literal>. diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..89ec5c30364 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -619,22 +619,25 @@ CreateAnonymousSegment(Size *size) allocsize += hugepagesize - (allocsize % hugepagesize); ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS | mmap_flags, -1, 0); mmap_errno = errno; if (huge_pages == HUGE_PAGES_TRY && ptr == MAP_FAILED) elog(DEBUG1, "mmap(%zu) with MAP_HUGETLB failed, huge pages disabled: %m", allocsize); } #endif + SetConfigOption("huge_pages_active", ptr == MAP_FAILED ? "false" : "true", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + if (ptr == MAP_FAILED && huge_pages != HUGE_PAGES_ON) { /* * Use the original size, not the rounded-up value, when falling back * to non-huge pages. */ allocsize = *size; ptr = mmap(NULL, allocsize, PROT_READ | PROT_WRITE, PG_MMAP_FLAGS, -1, 0); mmap_errno = errno; } diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..fa72b3d1f8f 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -319,22 +319,26 @@ retry: * If the segment already existed, CreateFileMapping() will return a * handle to the existing one and set ERROR_ALREADY_EXISTS. */ if (GetLastError() == ERROR_ALREADY_EXISTS) { CloseHandle(hmap); /* Close the handle, since we got a valid one * to the previous segment. */ hmap = NULL; Sleep(1000); continue; } + + SetConfigOption("huge_pages_active", (flProtect & SEC_LARGE_PAGES) ? + "true" : "false", PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + break; } /* * If the last call in the loop still returned ERROR_ALREADY_EXISTS, this * shared memory segment exists and we assume it belongs to somebody else. */ if (!hmap) ereport(FATAL, (errmsg("pre-existing shared memory block is still in use"), errhint("Check if there are any old server processes still running, and terminate them."))); diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index b21698934c8..1a298f16c81 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -554,22 +554,23 @@ static int server_version_num; #define DEFAULT_SYSLOG_FACILITY LOG_LOCAL0 #else #define DEFAULT_SYSLOG_FACILITY 0 #endif static int syslog_facility = DEFAULT_SYSLOG_FACILITY; static char *timezone_string; static char *log_timezone_string; static char *timezone_abbreviations_string; static char *data_directory; static char *session_authorization_string; +static char *huge_pages_active = "unknown"; /* dynamically set */ static int max_function_args; static int max_index_keys; static int max_identifier_length; static int block_size; static int segment_size; static int shared_memory_size_mb; static int shared_memory_size_in_huge_pages; static int wal_block_size; static bool data_checksums; static bool integer_datetimes; @@ -4516,22 +4517,33 @@ struct config_string ConfigureNamesString[] = { {"backtrace_functions", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Log backtrace for errors in these functions."), NULL, GUC_NOT_IN_SAMPLE }, &backtrace_functions, "", check_backtrace_functions, assign_backtrace_functions, NULL }, + { + {"huge_pages_active", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates whether huge pages are in use."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_RUNTIME_COMPUTED + }, + &huge_pages_active, + "unknown", + NULL, NULL, NULL + }, + /* End-of-list marker */ { {NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL } }; struct config_enum ConfigureNamesEnum[] = { { {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, -- 2.34.1 --OrT4iOlIQZp3kw4S Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0002-f-convert-to-an-enum.txt" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v6] add GUC: huge_pages_active @ 2023-01-24 00:33 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2023-01-24 00:33 UTC (permalink / raw) This is useful to show the current state of huge pages when huge_pages=try. The effective status is not otherwise visible without OS level tools like gdb or /proc/N/smaps. https://www.postgresql.org/message-id/flat/TU4PR8401MB1152EBB0D271F827E2E37A01EECC9@TU4PR8401MB1152.... --- doc/src/sgml/config.sgml | 17 ++++++++++++++++- src/backend/port/sysv_shmem.c | 3 +++ src/backend/port/win32_shmem.c | 4 ++++ src/backend/utils/misc/guc_tables.c | 20 ++++++++++++++++++++ src/include/storage/pg_shmem.h | 5 +++-- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 510ff88fc5e..88998238645 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1708,7 +1708,8 @@ include_dir 'conf.d' server will try to request huge pages, but fall back to the default if that fails. With <literal>on</literal>, failure to request huge pages will prevent the server from starting up. With <literal>off</literal>, - huge pages will not be requested. + huge pages will not be requested. The actual state of huge pages is + indicated by the server variable <xref linkend="guc-huge-pages-status"/>. </para> <para> @@ -10660,6 +10661,20 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' </listitem> </varlistentry> + <varlistentry id="guc-huge-pages-status" xreflabel="huge_pages_status"> + <term><varname>huge_pages_status</varname> (<type>enum</type>) + <indexterm> + <primary><varname>huge_pages_status</varname> configuration parameter</primary> + </indexterm> + </term> + <listitem> + <para> + Reports the state of huge pages in the current instance. + See <xref linkend="guc-huge-pages"/> for more information. + </para> + </listitem> + </varlistentry> + <varlistentry id="guc-integer-datetimes" xreflabel="integer_datetimes"> <term><varname>integer_datetimes</varname> (<type>boolean</type>) <indexterm> diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index eaba244bc9c..b6104c6ce60 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -627,6 +627,9 @@ CreateAnonymousSegment(Size *size) } #endif + SetConfigOption("huge_pages_status", ptr == MAP_FAILED ? "off" : "on", + PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + if (ptr == MAP_FAILED && huge_pages != HUGE_PAGES_ON) { /* diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 62e08074770..199f2e23a13 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -327,6 +327,10 @@ retry: Sleep(1000); continue; } + + SetConfigOption("huge_pages_status", (flProtect & SEC_LARGE_PAGES) ? + "on" : "off", PGC_INTERNAL, PGC_S_DYNAMIC_DEFAULT); + break; } diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 8696d965dee..785bee948e9 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -348,6 +348,13 @@ static const struct config_enum_entry huge_pages_options[] = { {NULL, 0, false} }; +static const struct config_enum_entry huge_pages_status_options[] = { + {"off", HUGE_PAGES_OFF, false}, + {"on", HUGE_PAGES_ON, false}, + {"unknown", HUGE_PAGES_UNKNOWN, false}, + {NULL, 0, false} +}; + static const struct config_enum_entry recovery_prefetch_options[] = { {"off", RECOVERY_PREFETCH_OFF, false}, {"on", RECOVERY_PREFETCH_ON, false}, @@ -536,6 +543,8 @@ int ssl_renegotiation_limit; int huge_pages = HUGE_PAGES_TRY; int huge_page_size; +int huge_pages_status = HUGE_PAGES_UNKNOWN; + /* * These variables are all dummies that don't do anything, except in some * cases provide the value for SHOW to display. The real state is elsewhere @@ -4833,6 +4842,17 @@ struct config_enum ConfigureNamesEnum[] = NULL, NULL, NULL }, + { + {"huge_pages_status", PGC_INTERNAL, PRESET_OPTIONS, + gettext_noop("Indicates the status of huge pages."), + NULL, + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE + }, + &huge_pages_status, + HUGE_PAGES_UNKNOWN, huge_pages_status_options, + NULL, NULL, NULL + }, + { {"recovery_prefetch", PGC_SIGHUP, WAL_RECOVERY, gettext_noop("Prefetch referenced blocks during recovery."), diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h index 4dd05f156d5..bfda42b0b26 100644 --- a/src/include/storage/pg_shmem.h +++ b/src/include/storage/pg_shmem.h @@ -46,12 +46,13 @@ extern PGDLLIMPORT int shared_memory_type; extern PGDLLIMPORT int huge_pages; extern PGDLLIMPORT int huge_page_size; -/* Possible values for huge_pages */ +/* Possible values for huge_pages/huge_pages_status */ typedef enum { HUGE_PAGES_OFF, HUGE_PAGES_ON, - HUGE_PAGES_TRY + HUGE_PAGES_TRY, /* only for huge_pages */ + HUGE_PAGES_UNKNOWN /* only for huge_pages_status */ } HugePagesType; /* Possible values for shared_memory_type */ -- 2.34.1 --HsPhGMMkM6t+clob-- ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2023-01-24 00:33 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-16 01:51 [PATCH v7 3/4] Add documentation for ALTER SUBSCRIPTION...ADD/DROP PUBLICATION Bharath Rupireddy <[email protected]> 2023-01-24 00:33 [PATCH v6] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH v3] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH v7] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH v8] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH v2] add GUC: huge_pages_active Justin Pryzby <[email protected]> 2023-01-24 00:33 [PATCH v4 1/2] add GUC: huge_pages_active Justin Pryzby <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox