Rename io_direct to debug_io_direct.
authorThomas Munro <tmunro@postgresql.org>
Sun, 14 May 2023 22:31:14 +0000 (10:31 +1200)
committerThomas Munro <tmunro@postgresql.org>
Sun, 14 May 2023 22:31:14 +0000 (10:31 +1200)
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 <noah@leadboat.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com> (the idea, not the patch)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (ditto)
Discussion: https://postgr.es/m/20230430041106.GA2268796%40rfd.leadboat.com

doc/src/sgml/config.sgml
src/backend/storage/file/fd.c
src/backend/utils/misc/guc_tables.c
src/test/modules/test_misc/t/004_io_direct.pl

index 909a3f28c790161462b407e91a686d1178b24c4a..2073bafa1f1b5e35de3c2c0458cc13bb6517143d 100644 (file)
@@ -11160,6 +11160,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>
@@ -11221,38 +11253,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>
index 4f86d44d6e387a49035dd2d05afa211749c89caf..173476789c76654860ee679521e26e4929cdbb7d 100644 (file)
@@ -3844,7 +3844,7 @@ check_io_direct(char **newval, void **extra, GucSource source)
 #if PG_O_DIRECT == 0
    if (strcmp(*newval, "") != 0)
    {
-       GUC_check_errdetail("io_direct is not supported on this platform.");
+       GUC_check_errdetail("debug_io_direct is not supported on this platform.");
        result = false;
    }
    flags = 0;
@@ -3859,7 +3859,7 @@ check_io_direct(char **newval, void **extra, GucSource source)
    if (!SplitGUCList(rawstring, ',', &elemlist))
    {
        GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
-                           "io_direct");
+                           "debug_io_direct");
        pfree(rawstring);
        list_free(elemlist);
        return false;
@@ -3891,14 +3891,14 @@ check_io_direct(char **newval, void **extra, GucSource source)
 #if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
    if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
    {
-       GUC_check_errdetail("io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
+       GUC_check_errdetail("debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
        result = false;
    }
 #endif
 #if BLCKSZ < PG_IO_ALIGN_SIZE
    if (result && (flags & IO_DIRECT_DATA))
    {
-       GUC_check_errdetail("io_direct is not supported for data because BLCKSZ is too small");
+       GUC_check_errdetail("debug_io_direct is not supported for data because BLCKSZ is too small");
        result = false;
    }
 #endif
index 5f90aecd47842dbf7873d8956a61607c04e9af5e..efd59a47cf72d01599d5b98883d074d9855e5e71 100644 (file)
@@ -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
index b8814bb6402f750d234a36853b19d33366dc648f..dddcfb1aa96594995a1b2e531300e98e987d8b15 100644 (file)
@@ -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
 });