pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
Date: Thu, 29 Feb 2024 14:46:07 +0900
Message-ID: <ZeAaH7GQobcZync0@paquier.xyz> (raw)
In-Reply-To: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com>
References: <18363-e3598a5a572d0699@postgresql.org>
	<1541688.1708893428@sss.pgh.pa.us>
	<ZdvF3lD5W9IySEa8@paquier.xyz>
	<1660000.1708902298@sss.pgh.pa.us>
	<6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com>

On Mon, Feb 26, 2024 at 09:00:01AM +0300, Alexander Lakhin wrote:
> It looks like currentlyReindexedIndex == 0 in this case, so
> ReindexIsProcessingIndex() doesn't guard against get_relation_info() ->
> _bt_getrootheight() -> _bt_getbuf() -> ReadBuffer() -> ... -> mdread().

Fun.  The concurrent case is actually able to work because it looks
like the basic definition of the relation exists with its relfilenode.

I was looking at that, and it seems to me that the point is not that
the index is being reindexed; the point is that we want to prevent
access to the index itself while it being built.  And that's something
that can happen for a reindex as much as a new index.  It would be
possible to paint an equivalent of SetReindexProcessing() in
index_create() for index_build() where a trace of the index OID
getting built is kept around, and it would be possible to trigger the
same  error as when doing a reindex.  Hence, if we were to do that,
the current ReindexIs*() routines maintaining the list of the indexes 
being built across transaction states are a bit misnamed, and the
error messages would be partially incorrect.

I am not sure if this is worth bothering beyond HEAD, or worth
bothering at all, but seeing 940489b467 it looks like we do bother
even for stable branches.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (6+ messages)

Message-ID: <ZeAaH7GQobcZync0@paquier.xyz>
Permalink:  ../ZeAaH7GQobcZync0@paquier.xyz/
Also on:    postgresql.org/message-id/ZeAaH7GQobcZync0@paquier.xyz

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, exclusion@gmail.com, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
  In-Reply-To: <ZeAaH7GQobcZync0@paquier.xyz>

* 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