Why is XLOG_FPI_FOR_HINT always need backups?
Hi all,
When I read the source code file src/backend/access/transam/xloginsert.c, I get something confused me.
In the function XLogSaveBufferForHint, the flags are always REGBUF_FORCE_IMAGE which means it is always need backups.
Is it right? Why do not check the full_page_writes?
--
Zhang Wenjie
Attachments:
check_synchronous_standby_names.patchapplication/octet-stream; charset=ISO-8859-1; name=check_synchronous_standby_names.patchDownload
From 82a1e45e80d6699dd0a70066c692138b8c1b470f Mon Sep 17 00:00:00 2001
From: "zhangwenjie" <757634191@qq.com>
Date: Fri, 14 Jun 2019 17:23:39 +0800
Subject: [PATCH] While synchronous_standby_names is like 'FIRST 3 (1,2)' or
'ANY 22 (1,2,3)' and synchronous_commit > SYNCHRONOUS_COMMIT_REMOTE_WRITE,
the processes will wait forever. It is dangerous, so check it in the
beginning is necessary.
---
src/backend/replication/syncrep.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 577791f3d5..78bb056e05 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -1172,6 +1172,13 @@ check_synchronous_standby_names(char **newval, void **extra, GucSource source)
syncrep_parse_result->num_sync);
return false;
}
+
+ if (syncrep_parse_result->num_sync > syncrep_parse_result->nmembers)
+ {
+ GUC_check_errmsg("number of synchronous standbys (%d) must be smaller than or equal to number of potential synchronous standbys (%d)",
+ syncrep_parse_result->num_sync, syncrep_parse_result->nmembers);
+ return false;
+ }
/* GUC extra value must be malloc'd, not palloc'd */
pconf = (SyncRepConfigData *)
--
2.19.1.3.ge56e4f7
On Tue, 06 Jul 2021 at 17:58, zwj <757634191@qq.com> wrote:
Hi all,
When I read the source code file src/backend/access/transam/xloginsert.c, I get something confused me.
In the function XLogSaveBufferForHint, the flags are always REGBUF_FORCE_IMAGE which means it is always need backups.
Is it right? Why do not check the full_page_writes?
The documentation [1]https://www.postgresql.org/docs/current/runtime-config-wal.html says:
------------------------------------------------------------------------------
wal_log_hints (boolean)
When this parameter is on, the PostgreSQL server writes the entire content of
each disk page to WAL during the first modification of that page after a
checkpoint, even for non-critical modifications of so-called hint bits.
------------------------------------------------------------------------------
Does that mean whether the full_page_writes enable or not, if the wal_log_hints
enabled, we always write the entire content of each disk page to WAL? If I'm
right, should we mention this in wal_log_hints?
[1]: https://www.postgresql.org/docs/current/runtime-config-wal.html
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.