pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check for conflicting queries during replay of gistvacuumpage()
Date: Thu, 20 Dec 2018 23:38:02 +0000
Message-ID: <E1ga7tC-0001Ot-Dr@gemulon.postgresql.org> (raw)

Check for conflicting queries during replay of gistvacuumpage()

013ebc0a7b implements so-called GiST microvacuum.  That is gistgettuple() marks
index tuples as dead when kill_prior_tuple is set.  Later, when new tuple
insertion claims page space, those dead index tuples are physically deleted
from page.  When this deletion is replayed on standby, it might conflict with
read-only queries.  But 013ebc0a7b doesn't handle this.  That may lead to
disappearance of some tuples from read-only snapshots on standby.

This commit implements resolving of conflicts between replay of GiST microvacuum
and standby queries.  On the master we implement new WAL record type
XLOG_GIST_DELETE, which comprises necessary information.  On stable releases
we've to be tricky to keep WAL compatibility.  Information required for conflict
processing is just appended to data of XLOG_GIST_PAGE_UPDATE record.  So,
PostgreSQL version, which doesn't know about conflict processing, will just
ignore that.

Reported-by: Andres Freund
Diagnosed-by: Andres Freund
Discussion: https://postgr.es/m/20181212224524.scafnlyjindmrbe6%40alap3.anarazel.de
Author: Alexander Korotkov
Backpatch-through: 9.6

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1b02807457318fa61cb564b101669f82e1b7be23

Modified Files
--------------
src/backend/access/gist/gist.c       |  24 +++--
src/backend/access/gist/gistbuild.c  |   7 +-
src/backend/access/gist/gistvacuum.c |   3 +-
src/backend/access/gist/gistxlog.c   | 193 ++++++++++++++++++++++++++++++++++-
src/include/access/gist_private.h    |   9 +-
5 files changed, 220 insertions(+), 16 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1ga7tC-0001Ot-Dr@gemulon.postgresql.org>
Permalink:  ../E1ga7tC-0001Ot-Dr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ga7tC-0001Ot-Dr@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: akorotkov@postgresql.org
  Subject: Re: pgsql: Check for conflicting queries during replay of gistvacuumpage()
  In-Reply-To: <E1ga7tC-0001Ot-Dr@gemulon.postgresql.org>
  References: <E1ga7tC-0001Ot-Dr@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