XLOG_PARAMETER_CHANGE (WAL record) missing two params in its desc routine
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
Attachments:
0001-Fix-wal_log_hints-management-in-xlog-resource-manage.patchapplication/x-patch; name=0001-Fix-wal_log_hints-management-in-xlog-resource-manage.patchDownload
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
0002-Mention-update-of-track_commit_timestamps-in-XLOG_PA.patchapplication/x-patch; name=0002-Mention-update-of-track_commit_timestamps-in-XLOG_PA.patchDownload
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
On 12/05/2014 04:54 AM, Michael Paquier wrote:
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
You got the wal_level and wal_log_hints strings backwards:
rmgr: XLOG len (rec/tot): 24/ 50, tx: 0, lsn:
0/07172488, prev 0/07172418, desc: PARAMETER_CHANGE max_connections=100
max_worker_processes=8 max_prepared_xacts=0 max_locks_per_xact=64
wal_level=false wal_log_hints=hot_standby
Fixed that, and changed "true"/"false" to "on"/"off", as that's more
common phrasing for boolean GUCs.
- patch 2 is master-only, and needs to be applied on top of patch 1.
Same here.
Committed both patches with those fixes, thanks!
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On Fri, Dec 5, 2014 at 7:12 PM, Heikki Linnakangas <hlinnakangas@vmware.com>
wrote:
On 12/05/2014 04:54 AM, Michael Paquier wrote:
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 addedYou got the wal_level and wal_log_hints strings backwards:
Oops. Thanks for double-checking.
--
Michael