On 01.05.23 04:47, Thomas Munro wrote:
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.

I suggest to also rename the hook functions (check and assign), like in the attached patch. Mainly because utils/guc_hooks.h says to order the functions by GUC variable name, which was already wrong under the old name, but it would be pretty confusing to sort the functions by their GUC name that doesn't match the function names.
From b549b5972410f28a375325e09f022f703afc12ab Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Tue, 22 Aug 2023 14:12:45 +0200
Subject: [PATCH] Rename hook functions for debug_io_direct to match variable
 name

---
 src/backend/storage/file/fd.c       | 6 +++---
 src/backend/utils/misc/guc_tables.c | 6 +++---
 src/include/utils/guc_hooks.h       | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 3c2a2fbef7..16b3e8f905 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3886,7 +3886,7 @@ data_sync_elevel(int elevel)
 }
 
 bool
-check_io_direct(char **newval, void **extra, GucSource source)
+check_debug_io_direct(char **newval, void **extra, GucSource source)
 {
        bool            result = true;
        int                     flags;
@@ -3960,7 +3960,7 @@ check_io_direct(char **newval, void **extra, GucSource 
source)
        if (!result)
                return result;
 
-       /* Save the flags in *extra, for use by assign_io_direct */
+       /* Save the flags in *extra, for use by assign_debug_io_direct */
        *extra = guc_malloc(ERROR, sizeof(int));
        *((int *) *extra) = flags;
 
@@ -3968,7 +3968,7 @@ check_io_direct(char **newval, void **extra, GucSource 
source)
 }
 
 extern void
-assign_io_direct(const char *newval, void *extra)
+assign_debug_io_direct(const char *newval, void *extra)
 {
        int                *flags = (int *) extra;
 
diff --git a/src/backend/utils/misc/guc_tables.c 
b/src/backend/utils/misc/guc_tables.c
index 15b51f2c5b..45b93fe0f9 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -563,7 +563,7 @@ static char *datestyle_string;
 static char *server_encoding_string;
 static char *server_version_string;
 static int     server_version_num;
-static char *io_direct_string;
+static char *debug_io_direct_string;
 
 #ifdef HAVE_SYSLOG
 #define        DEFAULT_SYSLOG_FACILITY LOG_LOCAL0
@@ -4544,9 +4544,9 @@ struct config_string ConfigureNamesString[] =
                        NULL,
                        GUC_LIST_INPUT | GUC_NOT_IN_SAMPLE
                },
-               &io_direct_string,
+               &debug_io_direct_string,
                "",
-               check_io_direct, assign_io_direct, NULL
+               check_debug_io_direct, assign_debug_io_direct, NULL
        },
 
        /* End-of-list marker */
diff --git a/src/include/utils/guc_hooks.h b/src/include/utils/guc_hooks.h
index 2ecb9fc086..952293a1c3 100644
--- a/src/include/utils/guc_hooks.h
+++ b/src/include/utils/guc_hooks.h
@@ -49,6 +49,8 @@ extern bool check_cluster_name(char **newval, void **extra, 
GucSource source);
 extern const char *show_data_directory_mode(void);
 extern bool check_datestyle(char **newval, void **extra, GucSource source);
 extern void assign_datestyle(const char *newval, void *extra);
+extern bool check_debug_io_direct(char **newval, void **extra, GucSource 
source);
+extern void assign_debug_io_direct(const char *newval, void *extra);
 extern bool check_default_table_access_method(char **newval, void **extra,
                                                                                
          GucSource source);
 extern bool check_default_tablespace(char **newval, void **extra,
@@ -157,7 +159,5 @@ extern bool check_wal_consistency_checking(char **newval, 
void **extra,
                                                                                
   GucSource source);
 extern void assign_wal_consistency_checking(const char *newval, void *extra);
 extern void assign_xlog_sync_method(int new_sync_method, void *extra);
-extern bool check_io_direct(char **newval, void **extra, GucSource source);
-extern void assign_io_direct(const char *newval, void *extra);
 
 #endif                                                 /* GUC_HOOKS_H */
-- 
2.41.0

Reply via email to