Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data

From: Noah Misch <noah(at)leadboat(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data
Date: 2021-07-19 00:30:09
Message-ID: 20210719003009.GA931573@gust.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Jul 18, 2021 at 10:17:28AM +0500, Andrey Borodin wrote:
> > 18 июля 2021 г., в 01:12, Noah Misch <noah(at)leadboat(dot)com> написал(а):
> >
> > Suppose some transaction has a vxid but no xid. Shortly after
> > GetLockConflicts(), it acquires an xid, modifies the table, and issues PREPARE
> > TRANSACTION. Could that cause a corrupt index even with this diff?
>
> Firstly I've tried to stress things out. This little go program [0] easily reproduces corruption on patched code.

By "patched code", you mean return_xids_with_vxids.diff applied to recent
master, right?

> Meanwhile vxid->xid->2px program does not [1] (both patched and unpatched).
>
> I think CIC does not care much about VXIDs at all. It's only important when real XID started: before GetLockConflicts() or after.

CIC likes VXIDs because they're assigned early in the xact, before any catalog
access. Consider the DefineIndex() step "wait until no running transaction
could have the table open with the old list of indexes." ExecOpenIndices()
can happen before AssignTransactionId(), so waiting on XIDs alone wouldn't
suffice.

To fix $SUBJECT, it sounds like we need a way to identify a transaction,
usable as early as the transaction's first catalog access and remaining valid
until COMMIT PREPARED finishes. We may initially see a transaction as having
a VXID and no XID, then later need to wait for that transaction when it has
entered prepared state, having an XID and no VXID. How might we achieve that?

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-07-19 02:13:18 Re: BUG #17103: WAL segments are not removed after exceeding max_slot_wal_keep_size
Previous Message PG Bug reporting form 2021-07-18 21:00:01 BUG #17113: Assert failed on calling a function fixed after an extension reload