Skip to content

Commit 319bae9

Browse files
committed
Rename io_direct to debug_io_direct.
Give the new GUC introduced by d4e71df 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
1 parent 4d5105a commit 319bae9

File tree

4 files changed

+38
-38
lines changed

4 files changed

+38
-38
lines changed

doc/src/sgml/config.sgml

+32-32
Original file line numberDiff line numberDiff line change
@@ -11160,6 +11160,38 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1116011160
</listitem>
1116111161
</varlistentry>
1116211162

11163+
<varlistentry id="guc-debug-io-direct" xreflabel="debug_io_direct">
11164+
<term><varname>debug_io_direct</varname> (<type>string</type>)
11165+
<indexterm>
11166+
<primary><varname>debug_io_direct</varname> configuration parameter</primary>
11167+
</indexterm>
11168+
</term>
11169+
<listitem>
11170+
<para>
11171+
Ask the kernel to minimize caching effects for relation data and WAL
11172+
files using <literal>O_DIRECT</literal> (most Unix-like systems),
11173+
<literal>F_NOCACHE</literal> (macOS) or
11174+
<literal>FILE_FLAG_NO_BUFFERING</literal> (Windows).
11175+
</para>
11176+
<para>
11177+
May be set to an empty string (the default) to disable use of direct
11178+
I/O, or a comma-separated list of operations that should use direct I/O.
11179+
The valid options are <literal>data</literal> for
11180+
main data files, <literal>wal</literal> for WAL files, and
11181+
<literal>wal_init</literal> for WAL files when being initially
11182+
allocated.
11183+
</para>
11184+
<para>
11185+
Some operating systems and file systems do not support direct I/O, so
11186+
non-default settings may be rejected at startup or cause errors.
11187+
</para>
11188+
<para>
11189+
Currently this feature reduces performance, and is intended for
11190+
developer testing only.
11191+
</para>
11192+
</listitem>
11193+
</varlistentry>
11194+
1116311195
<varlistentry id="guc-debug-parallel-query" xreflabel="debug_parallel_query">
1116411196
<term><varname>debug_parallel_query</varname> (<type>enum</type>)
1116511197
<indexterm>
@@ -11221,38 +11253,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
1122111253
</listitem>
1122211254
</varlistentry>
1122311255

11224-
<varlistentry id="guc-io-direct" xreflabel="io_direct">
11225-
<term><varname>io_direct</varname> (<type>string</type>)
11226-
<indexterm>
11227-
<primary><varname>io_direct</varname> configuration parameter</primary>
11228-
</indexterm>
11229-
</term>
11230-
<listitem>
11231-
<para>
11232-
Ask the kernel to minimize caching effects for relation data and WAL
11233-
files using <literal>O_DIRECT</literal> (most Unix-like systems),
11234-
<literal>F_NOCACHE</literal> (macOS) or
11235-
<literal>FILE_FLAG_NO_BUFFERING</literal> (Windows).
11236-
</para>
11237-
<para>
11238-
May be set to an empty string (the default) to disable use of direct
11239-
I/O, or a comma-separated list of operations that should use direct I/O.
11240-
The valid options are <literal>data</literal> for
11241-
main data files, <literal>wal</literal> for WAL files, and
11242-
<literal>wal_init</literal> for WAL files when being initially
11243-
allocated.
11244-
</para>
11245-
<para>
11246-
Some operating systems and file systems do not support direct I/O, so
11247-
non-default settings may be rejected at startup or cause errors.
11248-
</para>
11249-
<para>
11250-
Currently this feature reduces performance, and is intended for
11251-
developer testing only.
11252-
</para>
11253-
</listitem>
11254-
</varlistentry>
11255-
1125611256
<varlistentry id="guc-post-auth-delay" xreflabel="post_auth_delay">
1125711257
<term><varname>post_auth_delay</varname> (<type>integer</type>)
1125811258
<indexterm>

src/backend/storage/file/fd.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -3844,7 +3844,7 @@ check_io_direct(char **newval, void **extra, GucSource source)
38443844
#if PG_O_DIRECT == 0
38453845
if (strcmp(*newval, "") != 0)
38463846
{
3847-
GUC_check_errdetail("io_direct is not supported on this platform.");
3847+
GUC_check_errdetail("debug_io_direct is not supported on this platform.");
38483848
result = false;
38493849
}
38503850
flags = 0;
@@ -3859,7 +3859,7 @@ check_io_direct(char **newval, void **extra, GucSource source)
38593859
if (!SplitGUCList(rawstring, ',', &elemlist))
38603860
{
38613861
GUC_check_errdetail("invalid list syntax in parameter \"%s\"",
3862-
"io_direct");
3862+
"debug_io_direct");
38633863
pfree(rawstring);
38643864
list_free(elemlist);
38653865
return false;
@@ -3891,14 +3891,14 @@ check_io_direct(char **newval, void **extra, GucSource source)
38913891
#if XLOG_BLCKSZ < PG_IO_ALIGN_SIZE
38923892
if (result && (flags & (IO_DIRECT_WAL | IO_DIRECT_WAL_INIT)))
38933893
{
3894-
GUC_check_errdetail("io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
3894+
GUC_check_errdetail("debug_io_direct is not supported for WAL because XLOG_BLCKSZ is too small");
38953895
result = false;
38963896
}
38973897
#endif
38983898
#if BLCKSZ < PG_IO_ALIGN_SIZE
38993899
if (result && (flags & IO_DIRECT_DATA))
39003900
{
3901-
GUC_check_errdetail("io_direct is not supported for data because BLCKSZ is too small");
3901+
GUC_check_errdetail("debug_io_direct is not supported for data because BLCKSZ is too small");
39023902
result = false;
39033903
}
39043904
#endif

src/backend/utils/misc/guc_tables.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4568,7 +4568,7 @@ struct config_string ConfigureNamesString[] =
45684568
},
45694569

45704570
{
4571-
{"io_direct", PGC_POSTMASTER, DEVELOPER_OPTIONS,
4571+
{"debug_io_direct", PGC_POSTMASTER, DEVELOPER_OPTIONS,
45724572
gettext_noop("Use direct I/O for file access."),
45734573
NULL,
45744574
GUC_LIST_INPUT | GUC_NOT_IN_SAMPLE

src/test/modules/test_misc/t/004_io_direct.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
$node->init;
4141
$node->append_conf(
4242
'postgresql.conf', qq{
43-
io_direct = 'data,wal,wal_init'
43+
debug_io_direct = 'data,wal,wal_init'
4444
shared_buffers = '256kB' # tiny to force I/O
4545
wal_level = replica # minimal runs out of shared_buffers when set so tiny
4646
});

0 commit comments

Comments
 (0)