On Mon, May 1, 2023 at 12:00 PM Tom Lane <t...@sss.pgh.pa.us> wrote:
> Justin Pryzby <pry...@telsasoft.com> writes:
> > On Sun, Apr 30, 2023 at 06:35:30PM +1200, Thomas Munro wrote:
> >> What about a
> >> warning message about that at startup if it's on?
>
> > Such a warning wouldn't be particularly likely to be seen by someone who
> > already didn't read/understand the docs for the not-feature that they
> > turned on.
>
> Yeah, I doubt that that would be helpful at all.

Fair enough.

> > Since this is -currently- a developer-only feature, it seems reasonable
> > to rename the GUC to debug_direct_io, and (at such time as it's
> > considered to be helpful to users) later rename it to direct_io.
>
> +1

Yeah, the future cross-version confusion thing is compelling.  OK,
here's a rename patch.  I left all the variable names and related
symbols as they were, so it's just the GUC that gains the prefix.  I
moved the documentation hunk up to be sorted alphabetically like
nearby entries, because that seemed to look nicer, even though the
list isn't globally sorted.
From f95fc08c47c7d429950e8f22ce93c35271adfb37 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.mu...@gmail.com>
Date: Mon, 1 May 2023 14:03:30 +1200
Subject: [PATCH] Rename io_direct to debug_io_direct.

Give the new GUC introduced by d4e71df6 a name that is clearly not
intended for mainstream use quite yet.

Future proposals would drop the prefix only after adding infrastructure
to make it efficient.  Having the switch in the tree sooner is good
because it might lead to new discoveries about the hazards awaiting us
on a wide range of systems, but that name was too enticing and could
lead to cross-version confusion in future, per complaints from Noah and
Justin.

Suggested-by: Noah Misch <n...@leadboat.com>
Reviewed-by: Justin Pryzby <pry...@telsasoft.com>
Reviewed-by: Tom Lane <t...@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index b56f073a91..4f4b5b0b74 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -11159,6 +11159,38 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       </listitem>
      </varlistentry>
 
+     <varlistentry id="guc-debug-io-direct" xreflabel="debug_io_direct">
+      <term><varname>debug_io_direct</varname> (<type>string</type>)
+      <indexterm>
+        <primary><varname>debug_io_direct</varname> configuration parameter</primary>
+      </indexterm>
+      </term>
+      <listitem>
+       <para>
+        Ask the kernel to minimize caching effects for relation data and WAL
+        files using <literal>O_DIRECT</literal> (most Unix-like systems),
+        <literal>F_NOCACHE</literal> (macOS) or
+        <literal>FILE_FLAG_NO_BUFFERING</literal> (Windows).
+       </para>
+       <para>
+        May be set to an empty string (the default) to disable use of direct
+        I/O, or a comma-separated list of operations that should use direct I/O.
+        The valid options are <literal>data</literal> for
+        main data files, <literal>wal</literal> for WAL files, and
+        <literal>wal_init</literal> for WAL files when being initially
+        allocated.
+       </para>
+       <para>
+        Some operating systems and file systems do not support direct I/O, so
+        non-default settings may be rejected at startup or cause errors.
+       </para>
+       <para>
+        Currently this feature reduces performance, and is intended for
+        developer testing only.
+       </para>
+      </listitem>
+     </varlistentry>
+
      <varlistentry id="guc-debug-parallel-query" xreflabel="debug_parallel_query">
       <term><varname>debug_parallel_query</varname> (<type>enum</type>)
       <indexterm>
@@ -11220,38 +11252,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       </listitem>
      </varlistentry>
 
-     <varlistentry id="guc-io-direct" xreflabel="io_direct">
-      <term><varname>io_direct</varname> (<type>string</type>)
-      <indexterm>
-        <primary><varname>io_direct</varname> configuration parameter</primary>
-      </indexterm>
-      </term>
-      <listitem>
-       <para>
-        Ask the kernel to minimize caching effects for relation data and WAL
-        files using <literal>O_DIRECT</literal> (most Unix-like systems),
-        <literal>F_NOCACHE</literal> (macOS) or
-        <literal>FILE_FLAG_NO_BUFFERING</literal> (Windows).
-       </para>
-       <para>
-        May be set to an empty string (the default) to disable use of direct
-        I/O, or a comma-separated list of operations that should use direct I/O.
-        The valid options are <literal>data</literal> for
-        main data files, <literal>wal</literal> for WAL files, and
-        <literal>wal_init</literal> for WAL files when being initially
-        allocated.
-       </para>
-       <para>
-        Some operating systems and file systems do not support direct I/O, so
-        non-default settings may be rejected at startup or cause errors.
-       </para>
-       <para>
-        Currently this feature reduces performance, and is intended for
-        developer testing only.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry id="guc-post-auth-delay" xreflabel="post_auth_delay">
       <term><varname>post_auth_delay</varname> (<type>integer</type>)
       <indexterm>
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index 2f42cebaf6..9f9cf7ce66 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -4568,7 +4568,7 @@ struct config_string ConfigureNamesString[] =
 	},
 
 	{
-		{"io_direct", PGC_POSTMASTER, DEVELOPER_OPTIONS,
+		{"debug_io_direct", PGC_POSTMASTER, DEVELOPER_OPTIONS,
 			gettext_noop("Use direct I/O for file access."),
 			NULL,
 			GUC_LIST_INPUT | GUC_NOT_IN_SAMPLE
diff --git a/src/test/modules/test_misc/t/004_io_direct.pl b/src/test/modules/test_misc/t/004_io_direct.pl
index b8814bb640..dddcfb1aa9 100644
--- a/src/test/modules/test_misc/t/004_io_direct.pl
+++ b/src/test/modules/test_misc/t/004_io_direct.pl
@@ -40,7 +40,7 @@ my $node = PostgreSQL::Test::Cluster->new('main');
 $node->init;
 $node->append_conf(
 	'postgresql.conf', qq{
-io_direct = 'data,wal,wal_init'
+debug_io_direct = 'data,wal,wal_init'
 shared_buffers = '256kB' # tiny to force I/O
 wal_level = replica # minimal runs out of shared_buffers when set so tiny
 });
-- 
2.39.2

Reply via email to