Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b48af6d

Browse files
committed
Fix initdb's handling of min_wal_size and max_wal_size.
In commit 3e51b27, 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
1 parent 4fe2aa7 commit b48af6d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/bin/initdb/initdb.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,13 @@ setup_config(void)
12791279
conflines = replace_guc_value(conflines, "dynamic_shared_memory_type",
12801280
dynamic_shared_memory_type, false);
12811281

1282+
/* Caution: these depend on wal_segment_size_mb, they're not constants */
1283+
conflines = replace_guc_value(conflines, "min_wal_size",
1284+
pretty_wal_size(DEFAULT_MIN_WAL_SEGS), false);
1285+
1286+
conflines = replace_guc_value(conflines, "max_wal_size",
1287+
pretty_wal_size(DEFAULT_MAX_WAL_SEGS), false);
1288+
12821289
/*
12831290
* Fix up various entries to match the true compile-time defaults. Since
12841291
* these are indeed defaults, keep the postgresql.conf lines commented.
@@ -1289,12 +1296,6 @@ setup_config(void)
12891296
conflines = replace_guc_value(conflines, "port",
12901297
DEF_PGPORT_STR, true);
12911298

1292-
conflines = replace_guc_value(conflines, "min_wal_size",
1293-
pretty_wal_size(DEFAULT_MIN_WAL_SEGS), true);
1294-
1295-
conflines = replace_guc_value(conflines, "max_wal_size",
1296-
pretty_wal_size(DEFAULT_MAX_WAL_SEGS), true);
1297-
12981299
#if DEFAULT_BACKEND_FLUSH_AFTER > 0
12991300
snprintf(repltok, sizeof(repltok), "%dkB",
13001301
DEFAULT_BACKEND_FLUSH_AFTER * (BLCKSZ / 1024));

0 commit comments

Comments
 (0)