Re: Potential data loss due to race condition during logical replication slot creation - Mailing list pgsql-bugs

From Amit Kapila
Subject Re: Potential data loss due to race condition during logical replication slot creation
Date
Msg-id CAA4eK1KyUUSO9gYKukcwqcgrFWtyuZsfkspjMriKv4uQ_9WZRQ@mail.gmail.com
Whole thread Raw
In response to RE: Potential data loss due to race condition during logical replication slot creation  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Responses RE: Potential data loss due to race condition during logical replication slot creation  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Re: Potential data loss due to race condition during logical replication slot creation  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-bugs
On Wed, Mar 13, 2024 at 3:17 PM Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> > Attached patch implemented the approach a) since no one made. I also added
> > the test which can do assertion failure, but not sure it should be included.
>

I feel setting "needs_full_snapshot" to true for decoding means the
snapshot will start tracking non-catalog committed xacts as well which
is costly. See SnapBuildCommitTxn(). Can we avoid this problem if we
would have list of all running xacts when we serialize the snapshot by
not decoding any xact whose xid lies in that list? If so, one idea to
achieve could be that we maintain the highest_running_xid while
serailizing the snapshot and then during restore if that
highest_running_xid is <= builder->initial_xmin_horizon, then we
ignore restoring the snapshot. We already have few such cases handled
in SnapBuildRestore().

--
With Regards,
Amit Kapila.



pgsql-bugs by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Re:RE: Re:BUG #18369: logical decoding core on AssertTXNLsnOrder()
Next
From: Amit Kapila
Date:
Subject: Re: Potential data loss due to race condition during logical replication slot creation