Hi all,

While reading the code in this area this morning, I noticed that
wal_log_hints and track_commit_timestamp are not mentioned in the desc
routine of XLOG_CHANGE_PARAMETER. Also, it is not mentioned in
postgresql.conf.sample that a value update of wal_log_hints requires a
system restart.

In order to fix those things, attached are two patches:
- patch 1 should be applied back to 9.4 where wal_log_hints has been added
- patch 2 is master-only, and needs to be applied on top of patch 1.
Regards,
-- 
Michael
From 5237f43c4fa8f97a67a98421c1a72a1377b2d5d0 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Fri, 5 Dec 2014 11:45:25 +0900
Subject: [PATCH 1/2] Fix wal_log_hints management in xlog resource manager

A couple of things are fixed here:
- In postgresql.conf, it was not mentioned that wal_log_hints requires
a restart when updated
- When issuing WAL record XLOG_PARAMETER_CHANGE, description function
did not log out value update of this parameter.

Backpatch to 9.4.
---
 src/backend/access/rmgrdesc/xlogdesc.c        | 5 ++++-
 src/backend/utils/misc/postgresql.conf.sample | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 6b5fea9..645eec1 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -108,11 +108,14 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
 			}
 		}
 
-		appendStringInfo(buf, "max_connections=%d max_worker_processes=%d max_prepared_xacts=%d max_locks_per_xact=%d wal_level=%s",
+		appendStringInfo(buf, "max_connections=%d max_worker_processes=%d "
+						 "max_prepared_xacts=%d max_locks_per_xact=%d "
+						 "wal_level=%s wal_log_hints=%s",
 						 xlrec.MaxConnections,
 						 xlrec.max_worker_processes,
 						 xlrec.max_prepared_xacts,
 						 xlrec.max_locks_per_xact,
+						 xlrec.wal_log_hints ? "true" : "false",
 						 wal_level_str);
 	}
 	else if (info == XLOG_FPW_CHANGE)
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index c4b546e..b053659 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -187,6 +187,7 @@
 					#   open_sync
 #full_page_writes = on			# recover from partial page writes
 #wal_log_hints = off			# also do full page writes of non-critical updates
+					# (change requires restart)
 #wal_buffers = -1			# min 32kB, -1 sets based on shared_buffers
 					# (change requires restart)
 #wal_writer_delay = 200ms		# 1-10000 milliseconds
-- 
2.2.0

From 475d38c557fc2361aef5395652e26dc3c10072fc Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Fri, 5 Dec 2014 11:49:41 +0900
Subject: [PATCH 2/2] Mention update of track_commit_timestamps in
 XLOG_PARAMETER_CHANGE

This parameter update was not mentioned in the description of this WAL
record.
---
 src/backend/access/rmgrdesc/xlogdesc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c
index 645eec1..7a2a842 100644
--- a/src/backend/access/rmgrdesc/xlogdesc.c
+++ b/src/backend/access/rmgrdesc/xlogdesc.c
@@ -110,12 +110,13 @@ xlog_desc(StringInfo buf, XLogReaderState *record)
 
 		appendStringInfo(buf, "max_connections=%d max_worker_processes=%d "
 						 "max_prepared_xacts=%d max_locks_per_xact=%d "
-						 "wal_level=%s wal_log_hints=%s",
+						 "wal_level=%s wal_log_hints=%s track_commit_timestamp=%s",
 						 xlrec.MaxConnections,
 						 xlrec.max_worker_processes,
 						 xlrec.max_prepared_xacts,
 						 xlrec.max_locks_per_xact,
 						 xlrec.wal_log_hints ? "true" : "false",
+						 xlrec.track_commit_timestamp ? "true" : "false",
 						 wal_level_str);
 	}
 	else if (info == XLOG_FPW_CHANGE)
-- 
2.2.0

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to