Possible premature SNAPBUILD_CONSISTENT with DB-specific running_xacts

Started by SATYANARAYANA NARLAPURAM7 months ago2 messageshackers

Thread notes

1 note#bug
hackorum-bot#bug
hackorum-bot
2 days ago

@global #bug

#bug
Jump to latest
#1SATYANARAYANA NARLAPURAM
satyanarlapuram@gmail.com

Hi hackers,

A cluster-wide decoder must never have its snapshot-builder state changed
by a database-specific running_xacts record. Adding a check to return it
early.
I think otherwise a cluster wide decoder can potentially go to
SNAPSHOT_CONSISTENT state immediately even though transactions older
than nextXid are still in progress on a different DB (not tracked by
running_xact
record). This race is now possible with cluster wide decoders and Repack
concurrently run.

Attached a patch to fix this. Thoughts?

Thanks
Satya

Attachments:

t139384_1
v1-snapbuild-only.patchapplication/octet-stream; name=v1-snapbuild-only.patchDownload+15-0
#2Amit Kapila
amit.kapila16@gmail.com
In reply to: SATYANARAYANA NARLAPURAM (#1)
Re: Possible premature SNAPBUILD_CONSISTENT with DB-specific running_xacts

On Mon, Apr 20, 2026 at 12:29 AM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:

A cluster-wide decoder must never have its snapshot-builder state changed
by a database-specific running_xacts record. Adding a check to return it early.
I think otherwise a cluster wide decoder can potentially go to
SNAPSHOT_CONSISTENT state immediately even though transactions older
than nextXid are still in progress on a different DB (not tracked by running_xact
record). This race is now possible with cluster wide decoders and Repack
concurrently run.

I think this has been discussed previously, see [1]/messages/by-id/CAA4eK1KWDbBk4FgbbWdivQLrPPzR4zgvfnHK4WjWC78rbuRVbg@mail.gmail.com. As per my
understanding, we are not in agreement for the need of this
db-specific handling in the snapbuilder, see [2]/messages/by-id/cdgw4sbbfcgk6du3iv54r2dgiy4tfywoklbotlmj4irxavdcr3@glxfw5jj277q[3]/messages/by-id/pveffyxhnuurhb44uzqlwo3rkyzorkfh2rot7uwzlf2axhfvbp@7nrs2omysxkc. So, adding more
improvements/fixes on top of it doesn't sound advisable.

[1]: /messages/by-id/CAA4eK1KWDbBk4FgbbWdivQLrPPzR4zgvfnHK4WjWC78rbuRVbg@mail.gmail.com
[2]: /messages/by-id/cdgw4sbbfcgk6du3iv54r2dgiy4tfywoklbotlmj4irxavdcr3@glxfw5jj277q
[3]: /messages/by-id/pveffyxhnuurhb44uzqlwo3rkyzorkfh2rot7uwzlf2axhfvbp@7nrs2omysxkc

--
With Regards,
Amit Kapila.