From: Tom Lane <tgl@sss.pgh.pa.us>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Noah Misch <noah@leadboat.com>
Cc: Xiaoran Wang <fanfuxiaoran@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Subject: Re: Recovering from detoast-related catcache invalidations
Date: Fri, 13 Dec 2024 10:30:22 -0500
Message-ID: <1066416.1734103822@sss.pgh.pa.us> (raw)
In-Reply-To: <ea198f85-5df0-464d-8a0a-45bf88166c33@iki.fi>
References: <CAGjhLkOoBEC9mLsnB42d3CO1vcMx71MLSEuigeABbQ8oRdA6gw@mail.gmail.com>
<329632.1705011663@sss.pgh.pa.us>
<CAGjhLkOFmzx9gbB8qudKxdg8UR0SApo-thKuPZ=1zJaZ6-ORXQ@mail.gmail.com>
<754826.1705090452@sss.pgh.pa.us>
<793469.1705092433@sss.pgh.pa.us>
<20240114201411.d0@rfd.leadboat.com>
<20240924212036.0a.nmisch@google.com>
<ea198f85-5df0-464d-8a0a-45bf88166c33@iki.fi>
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> CatalogCacheCreateEntry() can accept catcache invalidations when it
> opens the toast table, and it now has recheck logic to detect the case
> that the tuple it's processing (ntp) is invalidated. However, isn't it
> also possible that it accepts an invalidation message for a tuple that
> we had processed in an earlier iteration of the loop? Or that a new
> catalog tuple was inserted that should be part of the list we're building?
The expectation is that the list will be built and returned to the
caller, but it's already marked as stale so it will be rebuilt
on next request.
We could consider putting a loop around that, but (a) it might loop a
lot of times, and (b) returning a stale list isn't much different from
the situation where the list-invalidating event arrives a nanosecond
after we finish rather than a nanosecond before. Ultimately it's the
caller's responsibility that the returned list be consistent enough
for its purposes. It might achieve that by first taking a lock on a
related table, for example.
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, hlinnaka@iki.fi, noah@leadboat.com, fanfuxiaoran@gmail.com, andres@anarazel.de
Subject: Re: Recovering from detoast-related catcache invalidations
In-Reply-To: <1066416.1734103822@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