Fix wal_writer_flush_after initializer value.
authorThomas Munro <[email protected]>
Sun, 14 May 2023 22:45:19 +0000 (10:45 +1200)
committerThomas Munro <[email protected]>
Sun, 14 May 2023 23:19:54 +0000 (11:19 +1200)
Commit a73952b7956 (new in 16) required default values in guc_table.c
and C variable initializers to match.  This one only matched when
XLOG_BLCKSZ == 8kB.  Fix by using the same expression in both places
with a new DEFAULT_XXX macro, as done for other GUCs.

Reviewed-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/CA+hUKGLNmLV=VrT==5MqnbARgx2ifRSFtdd8ofdfrdSLL3yv5A@mail.gmail.com

src/backend/postmaster/walwriter.c
src/backend/utils/misc/guc_tables.c
src/include/postmaster/walwriter.h

index 65e84be39b9d2582e3adf6d63357e32e688fab95..266fbc23399545984f187bb01ded15c8442fa106 100644 (file)
@@ -68,7 +68,7 @@
  * GUC parameters
  */
 int                    WalWriterDelay = 200;
-int                    WalWriterFlushAfter = 128;
+int                    WalWriterFlushAfter = DEFAULT_WAL_WRITER_FLUSH_AFTER;
 
 /*
  * Number of do-nothing loops before lengthening the delay time, and the
index efd59a47cf72d01599d5b98883d074d9855e5e71..8abf9bb644677fda4370a59cea6c920e6b294405 100644 (file)
@@ -2780,7 +2780,7 @@ struct config_int ConfigureNamesInt[] =
                        GUC_UNIT_XBLOCKS
                },
                &WalWriterFlushAfter,
-               (1024 * 1024) / XLOG_BLCKSZ, 0, INT_MAX,
+               DEFAULT_WAL_WRITER_FLUSH_AFTER, 0, INT_MAX,
                NULL, NULL, NULL
        },
 
index 22281a97ba0831bba53de36d53b1cf881b6559ea..6eba7ad79cf8bf76ae495730d4cb3a2d68271e51 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef _WALWRITER_H
 #define _WALWRITER_H
 
+#define DEFAULT_WAL_WRITER_FLUSH_AFTER ((1024 * 1024) / XLOG_BLCKSZ)
+
 /* GUC options */
 extern PGDLLIMPORT int WalWriterDelay;
 extern PGDLLIMPORT int WalWriterFlushAfter;