aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-03-22 16:37:41 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-03-22 16:37:41 -0400
commitb48af6d174bb39bd688d52795aef2b9c10dd6e8c (patch)
tree6945ad0fa36aab65e7bd65e6168343b7bb5028a8 /src
parent4fe2aa7656dce2bd31d4807a6843ff495b9deb80 (diff)
downloadpostgresql-b48af6d174bb39bd688d52795aef2b9c10dd6e8c.tar.gz
postgresql-b48af6d174bb39bd688d52795aef2b9c10dd6e8c.zip
Fix initdb's handling of min_wal_size and max_wal_size.
In commit 3e51b278d, I misinterpreted the coding in setup_config() as setting min_wal_size and max_wal_size to compile-time-constant values. But it's not: there's a hidden dependency on --wal-segsize. Therefore leaving these variables commented out is the wrong thing. Per report from Andres Freund. Discussion: https://postgr.es/m/20230322200751.jvfvsuuhd3hgm6vv@awork3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/bin/initdb/initdb.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index acc6412c139..3c0bf5c0a89 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1279,6 +1279,13 @@ setup_config(void)
conflines = replace_guc_value(conflines, "dynamic_shared_memory_type",
dynamic_shared_memory_type, false);
+ /* Caution: these depend on wal_segment_size_mb, they're not constants */
+ conflines = replace_guc_value(conflines, "min_wal_size",
+ pretty_wal_size(DEFAULT_MIN_WAL_SEGS), false);
+
+ conflines = replace_guc_value(conflines, "max_wal_size",
+ pretty_wal_size(DEFAULT_MAX_WAL_SEGS), false);
+
/*
* Fix up various entries to match the true compile-time defaults. Since
* these are indeed defaults, keep the postgresql.conf lines commented.
@@ -1289,12 +1296,6 @@ setup_config(void)
conflines = replace_guc_value(conflines, "port",
DEF_PGPORT_STR, true);
- conflines = replace_guc_value(conflines, "min_wal_size",
- pretty_wal_size(DEFAULT_MIN_WAL_SEGS), true);
-
- conflines = replace_guc_value(conflines, "max_wal_size",
- pretty_wal_size(DEFAULT_MAX_WAL_SEGS), true);
-
#if DEFAULT_BACKEND_FLUSH_AFTER > 0
snprintf(repltok, sizeof(repltok), "%dkB",
DEFAULT_BACKEND_FLUSH_AFTER * (BLCKSZ / 1024));