pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid assertion failure with targeted recovery in standby mode.
Date: Mon, 09 Mar 2020 06:44:19 +0000
Message-ID: <E1jBC9D-00056e-C8@gemulon.postgresql.org> (raw)

Avoid assertion failure with targeted recovery in standby mode.

At the end of recovery, standby mode is turned off to re-fetch the last
valid record from archive or pg_wal. Previously, if recovery target was
reached and standby mode was turned off while the current WAL source
was stream, recovery could try to retrieve WAL file containing the last
valid record unexpectedly from stream even though not in standby mode.
This caused an assertion failure. That is, the assertion test confirms that
WAL file should not be retrieved from stream if standby mode is not true.

This commit moves back the current WAL source to archive if it's stream
even though not in standby mode, to avoid that assertion failure.

This issue doesn't cause the server to crash when built with assertion
disabled. In this case, the attempt to retrieve WAL file from stream not
in standby mode just fails. And then recovery tries to retrieve WAL file
from archive or pg_wal.

Back-patch to all supported branches.

Author: Kyotaro Horiguchi
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/20200227.124830.2197604521555566121.horikyota.ntt@gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b366e51729bb98506769b4f62bc3cf753d156464

Modified Files
--------------
src/backend/access/transam/xlog.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1jBC9D-00056e-C8@gemulon.postgresql.org>
Permalink:  ../E1jBC9D-00056e-C8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jBC9D-00056e-C8@gemulon.postgresql.org

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: Avoid assertion failure with targeted recovery in standby mode.
  In-Reply-To: <E1jBC9D-00056e-C8@gemulon.postgresql.org>
  References: <E1jBC9D-00056e-C8@gemulon.postgresql.org>

* 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