What we do in some similar cases is put the burden on initdb to fill in
the correct value by modifying postgresql.conf.sample appropriately.
It seems like that could be done easily here too. And it'd be a
back-patchable fix.
I haven't realized initdb can do that. I agree that would be the best
solution.
Indeed.
Maybe something like the following, or maybe it should include "bufmgr.h",
not sure.
--
Fabien.
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index c8a8c52..e014336 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1107,6 +1107,23 @@ setup_config(void)
"#update_process_title = off");
#endif
+#ifdef HAVE_SYNC_FILE_RANGE
+ /*
+ * see default in server/storage/bufmgr.h:
+ * DEFAULT_CHECKPOINT_FLUSH_AFTER 32
+ * DEFAULT_BGWRITER_FLUSH_AFTER 64
+ */
+ snprintf(repltok, sizeof(repltok), "#checkpoint_flush_after = %dkb",
+ 32 * (BLCKSZ / 1024));
+ conflines = replace_token(conflines, "#checkpoint_flush_after = 0",
+ repltok);
+
+ snprintf(repltok, sizeof(repltok), "#bgwriter_flush_after = %dkb",
+ 64 * (BLCKSZ / 1024));
+ conflines = replace_token(conflines, "#bgwriter_flush_after = 0",
+ repltok);
+#endif /* HAVE_SYNC_FILE_RANGE */
+
snprintf(path, sizeof(path), "%s/postgresql.conf", pg_data);
writefile(path, conflines);
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers