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));