Re: SERIALIZABLE can commit write skew after SSI summarization

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SERIALIZABLE can commit write skew after SSI summarization
Date: 2026-08-23 14:22:33
Message-ID: B3D39B81-413E-4DCB-98F3-475C3B99489F@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Jacob,

> 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?

Thank you!

Best regards, Andrey Borodin.

Attachment Content-Type Size
v1-0001-Test-SSI-conflict-detection-after-summarization.patch application/octet-stream 7.6 KB
v1-0002-Detect-SSI-conflicts-with-summarized-predicate-lo.patch application/octet-stream 3.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-08-23 15:22:31 Re: PGQ catalog representation and pg_dump support
Previous Message Pavel Stehule 2026-08-23 13:22:51 Re: missing possibility to use alternative translated month names in to_char function