From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Luca Ferrari <fluca1978@gmail.com>
Cc: pgsql-bugs@postgresql.org
Cc: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function
Date: Wed, 25 Jul 2018 16:37:26 -0700
Message-ID: <20180725233726.xwrgm4fwtj32ynba@alap3.anarazel.de> (raw)
In-Reply-To: <15803.1532561267@sss.pgh.pa.us>
References: <CAKoxK+5fVodiCtMsXKV_1YAKXbzwSfp7DgDqUmcUAzeAhf=HEQ@mail.gmail.com>
<20180627204439.4b7miflyolm4qtcz@alap3.anarazel.de>
<CAKoxK+5bCn5d0R5v6j8SQQtUobu9R+m1xTTat8zsD1jH3izeDA@mail.gmail.com>
<CAKoxK+7gQjxWYZiUm5q9M9dxd1mBgi=1rDwN0UNZbkXvB37Eiw@mail.gmail.com>
<20180628150209.n2qch5jtn3vt2xaa@alap3.anarazel.de>
<20180725231719.orjox4w6qhvopeck@alap3.anarazel.de>
<15803.1532561267@sss.pgh.pa.us>
On 2018-07-25 19:27:47 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2018-06-28 08:02:10 -0700, Andres Freund wrote:
> >> I wonder why we don't just generally trigger invalidations to an
> >> indexes' "owning" relation in CacheInvalidateHeapTuple()?
>
> > Tom, do you have any comments about the above?
>
> It seems like an ugly and fragile hack, offhand. I can see the point
> about needing to recompute the owning relation's index list, but there's
> no good reason why an update of a pg_index row ought to force that.
> You're using that as a proxy for creation or deletion of an index, but
> (at least in principle) pg_index rows might get updated for existing
> indexes.
Sure, but in at least some of those cases you'd also need to update the
list, as it could invalidate things like the determination of the oid,
pkey or whatnot index. But yea, I don't think it's a *great* idea, just
an idea worth considering.
> Also, it's not clear to me why the existing places that force relcache
> inval on the owning table during index create/delete aren't sufficient
> already. I suppose it's probably a timing problem, but it's not clear
> why hacking CacheInvalidateHeapTuple in this fashion fixes that, or why
> we could expect it to stay fixed.
Hm? As I point out in my email, there's simply nothing forcing an
invalidation in the relevant path? We register an invalidation, but only
*after* successfully building the entire index. So if the index build
fails, but we actually accessed the relcache (as e.g. the new
plan_create_index_workers() pretty much always does), the relcache entry
refers to the failed index build. I think it's basically a failure to
follow proper invalidation procedures - when modifying something
affecting a relcache entry it's not OK to delay the
CacheInvalidateRelcacheByTuple() to after a point where we can fail
nonFATALy.
Greetings,
Andres Freund
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-bugs@postgresql.org
Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, fluca1978@gmail.com, pg@bowt.ie, pgsql-general@postgresql.org
Subject: Re: could not read block 0 in file : read only 0 of 8192 bytes when doing nasty on immutable index function
In-Reply-To: <20180725233726.xwrgm4fwtj32ynba@alap3.anarazel.de>
References: <CAKoxK+5fVodiCtMsXKV_1YAKXbzwSfp7DgDqUmcUAzeAhf=HEQ@mail.gmail.com> <20180627204439.4b7miflyolm4qtcz@alap3.anarazel.de> <CAKoxK+5bCn5d0R5v6j8SQQtUobu9R+m1xTTat8zsD1jH3izeDA@mail.gmail.com> <CAKoxK+7gQjxWYZiUm5q9M9dxd1mBgi=1rDwN0UNZbkXvB37Eiw@mail.gmail.com> <20180628150209.n2qch5jtn3vt2xaa@alap3.anarazel.de> <20180725231719.orjox4w6qhvopeck@alap3.anarazel.de> <15803.1532561267@sss.pgh.pa.us> <20180725233726.xwrgm4fwtj32ynba@alap3.anarazel.de>
* 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