On Tue, Nov 25, 2025 at 3:46 PM Andres Freund <[email protected]> wrote:
>
>
> > > > I presume you didn't do this because HeapTupleSatisifiesMVCC() for
> > > > SNAPSHOT_MVCC calls the non-batch version (and, of course,
> > > > HeapTupleSatisifiesVisibility() is the much more common case).
> > > >
> > > > if (TransactionIdIsValid(xid))
> > > > {
> > > > if (BufferIsPermanent(buffer))
> > > > {
> > > > /* NB: xid must be known committed here! */
> > > > XLogRecPtr commitLSN =
> > > > TransactionIdGetCommitLSN(xid);
> > > >
> > > > if (XLogNeedsFlush(commitLSN) &&
> > > > BufferGetLSNAtomic(buffer) < commitLSN)
> > > > {
> > > > /* not flushed and no LSN interlock, so don't
> > > > set hint */
> > > > return; false;
> > > > }
> > > > }
> > > > }
> > > >
> > > > Separately, I was thinking, should we assert here about having the
> > > > right lock type?
> > >
> > > Not sure I get what assert of what locktype where?
> >
> > In SetHintBitsExt() that we have share-exclusive or above.
>
> We *don't* necessarily hold that though, it'll just be acquired by
> BufferBeginSetHintBits(). Or do you mean in the SHB_ENABLED case?
Yea, in the enabled case. Also, can't we skip the whole
if (TransactionIdIsValid(xid))
{
if (BufferIsPermanent(buffer))
{
/* NB: xid must be known committed here! */
XLogRecPtr commitLSN = TransactionIdGetCommitLSN(xid);
if (XLogNeedsFlush(commitLSN) &&
BufferGetLSNAtomic(buffer) < commitLSN)
{
/* not flushed and no LSN interlock, so don't set hint */
return;
}
}
}
part if state is SHB_DISABLED?
- Melanie