Re: Replication & recovery_min_apply_delay - Mailing list pgsql-hackers

From Asim R P
Subject Re: Replication & recovery_min_apply_delay
Date
Msg-id CANXE4TcZp4hNHS6JA12cY1-n7tC=zcQDG+B=E1205bqsosCOwQ@mail.gmail.com
Whole thread Raw
In response to Re: Replication & recovery_min_apply_delay  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Replication & recovery_min_apply_delay  (Asim Rama Praveen <apraveen@pivotal.io>)
List pgsql-hackers
Replay lag can build up naturally, even when recovery_min_apply_delay
is not set, because WAL generation on master is concurrent and WAL
replay on standby is performed by a single process.

Hao and I have incorporated the new GUC from Konstantin's patch
and used it to start WAL receiver in the main replay loop, regardless
of whether recover_min_apply_delay is set.

Instead of going through each existing WAL record to determine the
streaming start point, WAL received is changed to persist WAL segment
number of a new WAL segment just before it is created.  WAL streaming
always begins from WAL segment boundary.  The persistent segment
number can be easily used to compute the start point, which is the
beginning of that segment.

We also have a TAP test to demonstrate the problem in two situations -
(1) WAL receiver process dies due to replication connection getting
disconnected and (2) standby goes through restart.  The test uses
recovery_min_apply_delay to delay the replay and expects new commits
made after WAL receiver exit to not block.

Asim
Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Remove page-read callback from XLogReaderState.
Next
From: Justin Pryzby
Date:
Subject: Re: vacuum verbose detail logs are unclear; log at *start* of eachstage; show allvisible/frozen/hintbits