Re: BUG #17268: Possible corruption in toast index after reindex index concurrently

From: Andres Freund <andres(at)anarazel(dot)de>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Alexey Ermakov <alexey(dot)ermakov(at)dataegret(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: BUG #17268: Possible corruption in toast index after reindex index concurrently
Date: 2021-11-09 04:37:58
Message-ID: B706E617-2172-4460-845A-B76E5DB2E0A2@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On November 8, 2021 7:56:24 PM PST, Noah Misch <noah(at)leadboat(dot)com> wrote:
>On Mon, Nov 08, 2021 at 12:36:41PM -0800, Andres Freund wrote:
>> One possible way to fix this would be to make ReindexRelationConcurrently()
>> acquire a lock on the underlying table when reindexing a toast table. Another
>> to not release the lock in toast_save_datum().
>
>The latter is more future-proof. Does it have material disadvantages?

I don't immediately see any. But I've been long of the opinion, and had plenty discussions around it, that our habit of releasing locks early is far too widely used.

I do however wonder if there's other path to the problem, besides saving toast datums. We also release those locks early in other places, and while e.g. r/o locks won't cause a problem with this specific interlock, it could cause problem around dropping the relation, for example.

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-11-09 04:57:21 BUG #17276: pg_tblspc Permission denied
Previous Message Noah Misch 2021-11-09 03:56:24 Re: BUG #17268: Possible corruption in toast index after reindex index concurrently