Re: Assertion failure in SnapBuildInitialSnapshot()
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>,
Pradeep Kumar <spradeepkumar29@gmail.com>, Alexander Lakhin <exclusion@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>, vignesh C <vignesh21@gmail.com>, Andres Freund <andres@anarazel.de>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
Thomas Munro <thomas.munro@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-06T18:36:12Z
Lists: pgsql-hackers
On Thu, Nov 6, 2025 at 2:36 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Thu, Nov 6, 2025 at 12:03 PM Zhijie Hou (Fujitsu) > <houzj.fnst@fujitsu.com> wrote: > > > > On Thursday, October 30, 2025 7:01 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > > > > > > Also, I think it's worth considering the idea Robert shared before[1]: > > > > > > --- > > > But what about just surgically preventing that? > > > ProcArraySetReplicationSlotXmin() could refuse to retreat the values, > > > perhaps? If it computes an older value than what's there, it just does nothing? > > > --- > > > > > > We did a similar fix for confirmed_flush LSN by commit ad5eaf390c582, and it > > > sounds reasonable to me that ProcArraySetReplicationSlotXmin() refuses to > > > retreat the values. > > > > I reviewed the thread and think that we could not straightforwardly apply a > > similar strategy to prevent the retreat of xmin/catalog_xmin here. This is > > because we maintain a central value > > (replication_slot_xmin/replication_slot_catalog_xmin) in > > ProcArraySetReplicationSlotXmin, where the value is expected to decrease when > > certain slots are dropped or invalidated. > > > > Good point. This can happen when the last slot is invalidated or dropped. After the last slot is invalidated or dropped, both slot_xmin and slot_catalog_xmin values are set InvalidTransactionId. Then in this case, these values are ignored when computing the oldest safe decoding XID in GetOldestSafeDecodingTransactionId(), no? Or do you mean that there is a case where slot_xmin and slot_catalog_xmin retreat to a valid XID? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix a race condition in updating procArray->replication_slot_xmin.
- 2a5225b99d76 19 (unreleased) landed
- fd7c86cfaf13 18.2 landed
- 123b851abdac 17.8 landed
- 82146672261d 16.12 landed
- fa557d3005e7 15.16 landed
- 57048d6e1733 14.21 landed
-
Don't retreat slot's confirmed_flush LSN.
- ad5eaf390c58 18.0 cited
-
Add additional checks while creating the initial decoding snapshot.
- 240e0dbacd39 16.0 landed