Re: BUG #17949: Adding an index introduces serialisation anomalies.

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, artem(dot)anisimov(dot)255(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: Re: BUG #17949: Adding an index introduces serialisation anomalies.
Date: 2023-06-28 03:18:00
Message-ID: CA+hUKGKmrBFy-Z7XTHv6o5EV7WEhoscyTqyf=LTBeGjNoYnOkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 26, 2023 at 8:04 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> Yes, +1 on the patches. Any chance of constructing test cases for these?

Thanks for looking. I can't think of any good way to test
deterministically. All three depend on unlucky scheduling. Perhaps
if we had one of those 'pause insertion' systems that I have heard
talk of.

> > /*
> > - * We only get here if the index is completely empty. Lock relation
> > - * because nothing finer to lock exists.
> > + * Since we have no pages locked, it's possible for another
> > + * transaction to insert data between _bt_search() and
> > + * PredicateLockRelation(). We have to try again after taking a
> > + * relation-level predicate lock, to close a narrow window where we
> > + * wouldn't scan concurrently inserted tuples, but the writer wouldn't
> > + * see our predicate lock.
> > */
>
> I'd like to keep the old comment here, it's good context, and add the
> new text in addition to the old.

Done.

> v3-0002-Fix-race-in-SSI-interaction-with-bitmap-heap-scan.patch: Can we
> keep the optimization when not using SSI?

Done.

I'll push these in a couple of days if there are no further comments.

Attachment Content-Type Size
v4-0001-Fix-race-in-SSI-interaction-with-empty-btrees.patch text/x-patch 2.7 KB
v4-0002-Fix-race-in-SSI-interaction-with-bitmap-heap-scan.patch text/x-patch 2.5 KB
v4-0003-Fix-race-in-SSI-interaction-with-gin-fast-path.patch text/x-patch 3.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2023-06-28 06:00:00 Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index
Previous Message Andres Freund 2023-06-28 00:03:52 Re: BUG #18003: FATAL: cannot request additional shared memory outside shmem_request_hook