Re: SERIALIZABLE can commit write skew after SSI summarization

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>
Subject: Re: SERIALIZABLE can commit write skew after SSI summarization
Date: 2026-10-26 11:28:18
Message-ID: CAJ7c6TO+muJ+1WvDYWawX=-Uq-hxfozb9rt9-6GGHfBK-W1TPA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andrey,

> > once session 2's SIREAD locks move to virtualtransaction = '-1/0',
> > session 1 commits and the final count is 2.
>
> I reproduced this. The overlap test in CheckTargetForConflictsIn() uses
> finishedBefore for a committed transaction. OldCommittedSxact has no
> valid finishedBefore, so the test ignores its predicate locks.
>
> Each summarized predicate lock already stores the latest commitSeqNo
> among the transactions folded into it. PFA a tentative patch set which
> compares that with lastCommitBeforeSnapshot. A later commit means that
> at least one reader represented by the lock overlapped the writer.
>
> The first patch adds a deterministic injection-point test, and the
> second adds the fix.
>
> I have two buildfarm animals available for unusual configurations. One
> currently runs with WAL consistency checking, and the other checks WAL
> compatibility with a zero release version. I could enable
> TEST_SUMMARIZE_SERIAL on one of them. I had seen a related false
> negative while trying different modes around the Jepsen report, but did
> not pursue it then. Your report made me return to it. I am not sure
> whether the existing check-world schedules would have exposed this bug.
> Would permanently testing this mode be useful, and is there any reason
> not to do that?

Patch v1 needed a rebase. I reproduced the bug and verified that the
patch fixes it. All in all v1 looks good to me.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v2-0001-Test-SSI-conflict-detection-after-summarization.patch text/x-patch 7.7 KB
v2-0002-Detect-SSI-conflicts-with-summarized-predicate-lo.patch text/x-patch 3.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-10-26 11:39:33 Re: Event trigger table rewrite doc missing ALTER MATERIALIZED VIEW case
Previous Message Jeevan Chalke 2026-10-26 11:27:25 PL/pgSQL: FOUND is NULL, not false, in event trigger functions