pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Allow pg_receivewal to stream from a slot's restart LSN
3+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2021-10-26 8af09daf56 doc: Fix grammar in page of pg_receivewal
* pgsql: Allow pg_receivewal to stream from a slot's restart LSN
@ 2021-10-26 00:47 Michael Paquier <michael@paquier.xyz>
2021-10-26 02:23 ` Re: pgsql: Allow pg_receivewal to stream from a slot's restart LSN Kyotaro Horiguchi <horikyota.ntt@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2021-10-26 00:47 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Allow pg_receivewal to stream from a slot's restart LSN
Prior to this patch, when running pg_receivewal, the streaming start
point would be the current location of the archives if anything is
found in the local directory where WAL segments are written, and
pg_receivewal would fall back to the current WAL flush location if there
are no archives, as of the result of an IDENTIFY_SYSTEM command.
If for some reason the WAL files from pg_receivewal were moved, it is
better to try a restart where we left at, which is the replication
slot's restart_lsn instead of skipping right to the current flush
location, to avoid holes in the WAL backed up. This commit changes
pg_receivewal to use the following sequence of methods to determine the
starting streaming LSN:
- Scan the local archives.
- Use the slot's restart_lsn, if supported by the backend and if a slot
is defined.
- Fallback to the current flush LSN as reported by IDENTIFY_SYSTEM.
To keep compatibility with older server versions, we only attempt to use
READ_REPLICATION_SLOT if the backend version is at least 15, and
fallback to the older behavior of streaming from the current flush
LSN if the command is not supported.
Some TAP tests are added to cover this feature.
Author: Ronan Dunklau
Reviewed-by: Kyotaro Horiguchi, Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/18708360.4lzOvYHigE@aivenronan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f61e1dd2cee6b1a1da75c2bb0ca3bc72f18748c1
Modified Files
--------------
doc/src/sgml/ref/pg_receivewal.sgml | 11 ++++
src/bin/pg_basebackup/pg_receivewal.c | 31 ++++++++-
src/bin/pg_basebackup/streamutil.c | 97 ++++++++++++++++++++++++++++
src/bin/pg_basebackup/streamutil.h | 3 +
src/bin/pg_basebackup/t/020_pg_receivewal.pl | 53 ++++++++++++++-
5 files changed, 191 insertions(+), 4 deletions(-)
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Allow pg_receivewal to stream from a slot's restart LSN
2021-10-26 00:47 pgsql: Allow pg_receivewal to stream from a slot's restart LSN Michael Paquier <michael@paquier.xyz>
@ 2021-10-26 02:23 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2021-10-26 04:58 ` Re: pgsql: Allow pg_receivewal to stream from a slot's restart LSN Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 3+ messages in thread
From: Kyotaro Horiguchi @ 2021-10-26 02:23 UTC (permalink / raw)
To: michael@paquier.xyz; +Cc: pgsql-committers@lists.postgresql.org
At Tue, 26 Oct 2021 00:47:44 +0000, Michael Paquier <michael@paquier.xyz> wrote in
> Allow pg_receivewal to stream from a slot's restart LSN
...
> Details
> -------
> https://git.postgresql.org/pg/commitdiff/f61e1dd2cee6b1a1da75c2bb0ca3bc72f18748c1
Ouch.. sorry, it's a bit late.
I noticed a typo in the change.
+ If a starting point cannot not be calculated with the previous method,
The "not" is a duplicate.
reagrds.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachments:
fix_doc_pg_receivewal_sgml.patch (text/x-patch, 636B) download
diff --git a/doc/src/sgml/ref/pg_receivewal.sgml b/doc/src/sgml/ref/pg_receivewal.sgml
index d3c7488293..9fde2fd2ef 100644
--- a/doc/src/sgml/ref/pg_receivewal.sgml
+++ b/doc/src/sgml/ref/pg_receivewal.sgml
@@ -90,7 +90,7 @@ PostgreSQL documentation
<listitem>
<para>
- If a starting point cannot not be calculated with the previous method,
+ If a starting point cannot be calculated with the previous method,
and if a replication slot is used, an extra
<command>READ_REPLICATION_SLOT</command> command is issued to retrieve
the slot's <literal>restart_lsn</literal> to use as starting point.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Allow pg_receivewal to stream from a slot's restart LSN
2021-10-26 00:47 pgsql: Allow pg_receivewal to stream from a slot's restart LSN Michael Paquier <michael@paquier.xyz>
2021-10-26 02:23 ` Re: pgsql: Allow pg_receivewal to stream from a slot's restart LSN Kyotaro Horiguchi <horikyota.ntt@gmail.com>
@ 2021-10-26 04:58 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Paquier @ 2021-10-26 04:58 UTC (permalink / raw)
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>; +Cc: pgsql-committers@lists.postgresql.org
On Tue, Oct 26, 2021 at 11:23:04AM +0900, Kyotaro Horiguchi wrote:
> I noticed a typo in the change.
>
> + If a starting point cannot not be calculated with the previous method,
>
> The "not" is a duplicate.
Fixed, thanks.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-10-26 04:58 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 00:47 pgsql: Allow pg_receivewal to stream from a slot's restart LSN Michael Paquier <michael@paquier.xyz>
2021-10-26 02:23 ` Kyotaro Horiguchi <horikyota.ntt@gmail.com>
2021-10-26 04:58 ` Michael Paquier <michael@paquier.xyz>
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