Re: BUG #16961: Could not access status of transaction - Mailing list pgsql-bugs

From Daniil Davydov
Subject Re: BUG #16961: Could not access status of transaction
Date
Msg-id CAJDiXgj1BmLKAZ=gOC1eETmctt7z=aj8MHfmd+nORE1P6qncsA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16961: Could not access status of transaction  (Alexandra Wang <alexandra.wang.oss@gmail.com>)
Responses Re: BUG #16961: Could not access status of transaction
List pgsql-bugs
Hi,

On Fri, Aug 1, 2025 at 10:41 AM Alexandra Wang
<alexandra.wang.oss@gmail.com> wrote:
>
> I'm not sure what's the best solution here. When ComputeXidHorizons()
> determines the cutoff xid, it doesn't check asyncQueueControl for the
> sender's xids stored in each AsyncQueueEntry.  It make sense that the
> async queue itself isn't expected to survive a database restart, but
> should the sender's xids it stores be considered?
>
> What are your thoughts?
>

Finding the minimum xid in async queue may consume a lot of time, so I
don't think
that we should teach ComputeXidHorizons to look into async queue :
1) This is pretty "hot" function
2) We don't need minimal xid from async queue each time
ComputeXidHorizons is called

IMO, the best solution is to create something like the
"AsyncQueueMinXid" function and
call it in the beginning of vac_update_datfrozenxid. Thus,
newFrozenXid will be capped
by minimal sender's xid and autovacuum could not advance it too far.

If we want to find out the minimum xid in a reasonable amount of time, we need
something like a tree structure for xids from async queue (which will
be maintained
together with SLRU structures).

I still don't have a solution for it. Maybe we should write to the pgsql-hackers
mailing list with this problem?

BTW, I'll attach an interim solution of this problem to this letter
(explicitly advance
queue tail before advancing datfrozenxid).

--
Best regards,
Daniil Davydov

Attachment

pgsql-bugs by date:

Previous
From: Richard Guo
Date:
Subject: Re: BUG #19007: Planner fails to choose partial index with spurious 'not null'
Next
From: Fujii Masao
Date:
Subject: Re: Unexpected Standby Shutdown on sync_replication_slots change