Re: [PG19] A canceled notify read leaves the NOTIFY queue stuck

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, joel(at)compiler(dot)org, arseniy(dot)mukhin(dot)dev(at)gmail(dot)com
Subject: Re: [PG19] A canceled notify read leaves the NOTIFY queue stuck
Date: 2026-10-26 03:17:52
Message-ID: CAGRkXqThHq-=kQ9PRXw5mmhaD=a1ULDYaJYe2cArm4x0q9NGXw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

> Do we really need a serializable snapshot for reading the notify
> queue? If we do, can we acquire it before making any important state
> changes?

I did some investigation today and I don't think we need a serializable
snapshot.

If I understand correctly, the read only uses the snapshot to ask
XidInMVCCSnapshot() whether the sender is still running. But
GetLatestSnapshot() sets up the transaction snapshot when there is none
yet.
In a serializable read only deferrable transaction that waits for a safe
snapshot.

So we just need to call GetSnapshotData(), but that needs a snapshot.
I created a static one in async.c because feels like we should not
touch snapmgr for encapsulation. If you'd rather keep this in
snapmgr.c, a small wrapper there would work too.

Thanks,
Shihao

Attachment Content-Type Size
v2-0001-Don-t-wait-for-a-safe-snapshot-when-reading-the-n.patch application/octet-stream 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-10-26 03:17:55 Re: WAL record CRC calculated incorrectly because of underlying buffer modification
Previous Message Tender Wang 2026-10-26 03:13:47 Re: Self-join elimination discards differing row lock wait policies