From: alvherre@alvh.no-ip.org <alvherre@alvh.no-ip.org>
To: Jakub Wartak <Jakub.Wartak@tomtom.com>
Cc: Bossart, Nathan <bossartn@amazon.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Cc: mengjuan.cmj@alibaba-inc.com <mengjuan.cmj@alibaba-inc.com>
Subject: Re: prevent immature WAL streaming
Date: Wed, 25 Aug 2021 20:20:04 -0400
Message-ID: <202108260020.cjxmmc2m7iws@alvherre.pgsql> (raw)
In-Reply-To: <202108252329.oqhdllz2iq73@alvherre.pgsql>
BTW while going about testing this, I noticed that we forbid
pg_walfile_name() while in recovery. That restriction was added by
commit 370f770c15a4 because ThisTimeLineID was not set correctly during
recovery. That was supposed to be fixed by commit 1148e22a82ed, so I
thought that it should be possible to remove the restriction. However,
I did that per the attached patch, but was quickly disappointed because
ThisTimeLineID seems to remain zero in a standby for reasons that I
didn't investigate.
--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"The problem with the facetime model is not just that it's demoralizing, but
that the people pretending to work interrupt the ones actually working."
(Paul Graham)
Attachments:
[text/x-diff] 0001-Don-t-forbid-pg_walfile_name-in-recovery-mode.patch (1.0K, ../202108260020.cjxmmc2m7iws@alvherre.pgsql/2-0001-Don-t-forbid-pg_walfile_name-in-recovery-mode.patch)
download | inline diff:
From 1b57e504b9a7eeddf2d99e615f21c5aec042a908 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 25 Aug 2021 19:55:43 -0400
Subject: [PATCH] Don't forbid pg_walfile_name in recovery mode
---
src/backend/access/transam/xlogfuncs.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.cindex b98deb72ec..99b22d0b30 100644--- a/src/backend/access/transam/xlogfuncs.c+++ b/src/backend/access/transam/xlogfuncs.c@@ -503,13 +503,6 @@ pg_walfile_name(PG_FUNCTION_ARGS)
XLogRecPtr locationpoint = PG_GETARG_LSN(0);
char xlogfilename[MAXFNAMELEN];
- if (RecoveryInProgress())- ereport(ERROR,- (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),- errmsg("recovery is in progress"),- errhint("%s cannot be executed during recovery.",- "pg_walfile_name()")));-
XLByteToPrevSeg(locationpoint, xlogsegno, wal_segment_size);
XLogFileName(xlogfilename, ThisTimeLineID, xlogsegno, wal_segment_size);
--
2.30.2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, Jakub.Wartak@tomtom.com, bossartn@amazon.com, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org, mengjuan.cmj@alibaba-inc.com
Subject: Re: prevent immature WAL streaming
In-Reply-To: <202108260020.cjxmmc2m7iws@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox