Re: Exported snapshot of CREATE_REPLICATION_SLOT can lose tuples to pruning

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: Shlomi Noach <shlomi(at)planetscale(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Exported snapshot of CREATE_REPLICATION_SLOT can lose tuples to pruning
Date: 2026-12-02 03:42:09
Message-ID: CAFPTHDbwjBU1Tvf7kSnFH6tbAqV5mos2swaCnZbaNhew6hFTsQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 30, 2026 at 9:13 PM Shlomi Noach <shlomi(at)planetscale(dot)com> wrote:
>
> Hello,
>
> A snapshot exported by CREATE_REPLICATION_SLOT ... (SNAPSHOT 'export')
> can show the wrong row versions under concurrent updates: it can miss row
> versions it must show, or show row versions committed after the slot's
> consistent point. A client that copies its tables under the snapshot and
> then streams changes from the slot can lose rows, or receive a change
> both in the copy and from the slot.

Thanks for the report and the patches. I applied v1-0001 and v1-0002
on HEAD (dc168a8), built with --enable-injection-points and cassert,
and ran 062_slot_export_snapshot_xmin. With both patches the test
passes on every run. With 0001 reverted, keeping the injection point
from 0002, it fails on every run with:

got: '1|2'
expected: '1|1'

I agree with the analysis. The patches look good to me.

Regards,
Ajin Cherian
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-12-02 04:01:24 Re: Preserve conflict log table during upgrade
Previous Message Fujii Masao 2026-12-02 03:29:45 Re: postgres_fdw can crash on malformed remote results