pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr
Date: Mon, 09 Jul 2018 23:26:45 +0000
Message-ID: <E1fcfYL-00050C-Ac@gemulon.postgresql.org> (raw)

Avoid emitting a bogus WAL record when recycling an all-zero btree page.

Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for
a page that it was about to recycle.  However, it failed to distinguish
all-zero pages from dead pages, which is important because only the
latter have valid btpo.xact values, or indeed any special space at all.
Recycling an all-zero page with XLogStandbyInfoActive() enabled therefore
led to an Assert failure, or to emission of a WAL record containing a
bogus cutoff XID, which might lead to unnecessary query cancellations
on hot standby servers.

Per reports from Antonin Houska and 自己.  Amit Kapila was first to
propose this fix, and Robert Haas, myself, and Kyotaro Horiguchi
reviewed it at various times.

This is an old bug, so back-patch to all supported branches.

Discussion: https://postgr.es/m/2628.1474272158@localhost
Discussion: https://postgr.es/m/48875502.f4a0.1635f0c27b0.Coremail.zoulx1982@163.com

Branch
------
REL9_4_STABLE

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

Modified Files
--------------
src/backend/access/nbtree/nbtpage.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1fcfYL-00050C-Ac@gemulon.postgresql.org>
Permalink:  ../E1fcfYL-00050C-Ac@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fcfYL-00050C-Ac@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr
  In-Reply-To: <E1fcfYL-00050C-Ac@gemulon.postgresql.org>
  References: <E1fcfYL-00050C-Ac@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