pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: Weird planner issue on a standby
Date: Wed, 12 Oct 2022 09:47:14 -0400
Message-ID: <781474.1665582434@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2-Wz=RkYqXXoz+Hre61mn4MNzeLOPWoh2PNOP+66A=xNFZdA@mail.gmail.com>
References: <418848.1665505048@sss.pgh.pa.us>
	<20221011162736.cd2h5ajdbhtwdc4l@alvherre.pgsql>
	<CAH2-Wz=RkYqXXoz+Hre61mn4MNzeLOPWoh2PNOP+66A=xNFZdA@mail.gmail.com>

Peter Geoghegan <pg@bowt.ie> writes:
> That's true, but it doesn't matter whether or not there are LP_DEAD
> bits set on the standby, since in any case they cannot be trusted when
> in Hot Standby mode. IndexScanDescData.ignore_killed_tuples will be
> set to false on the standby.

Hmm.  I think that might break this argument in get_actual_variable_endpoint:

     * A crucial point here is that SnapshotNonVacuumable, with
     * GlobalVisTestFor(heapRel) as horizon, yields the inverse of the
     * condition that the indexscan will use to decide that index entries are
     * killable (see heap_hot_search_buffer()).  Therefore, if the snapshot
     * rejects a tuple (or more precisely, all tuples of a HOT chain) and we
     * have to continue scanning past it, we know that the indexscan will mark
     * that index entry killed.  That means that the next
     * get_actual_variable_endpoint() call will not have to re-consider that
     * index entry.  In this way we avoid repetitive work when this function
     * is used a lot during planning.

However, that doesn't explain the downthread report that a
VACUUM on the primary fixed it.  What I suspect is that that
caused some in-fact-dead index entries to get cleaned out.

But ... if the primary is allowed to vacuum away an index
entry that it thinks is dead, exactly what is the point of
making standbys ignore LP_DEAD bits?  There's no additional
interlock that guarantees the tuple will be there at all.

			regards, tom lane





view thread (15+ messages)  latest in thread

Message-ID: <781474.1665582434@sss.pgh.pa.us>
Permalink:  ../781474.1665582434@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/781474.1665582434@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pg@bowt.ie, alvherre@alvh.no-ip.org, guillaume@lelarge.info
  Subject: Re: Weird planner issue on a standby
  In-Reply-To: <781474.1665582434@sss.pgh.pa.us>
  References: <418848.1665505048@sss.pgh.pa.us> <20221011162736.cd2h5ajdbhtwdc4l@alvherre.pgsql> <CAH2-Wz=RkYqXXoz+Hre61mn4MNzeLOPWoh2PNOP+66A=xNFZdA@mail.gmail.com> <781474.1665582434@sss.pgh.pa.us>

* 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