Re: [PATCH] Avoid pallocs in async.c's "critical section"

Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>

From: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
To: Joel Jacobson <joel@compiler.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-11-26T07:00:31Z
Lists: pgsql-hackers
Hi,

On Tue, Nov 25, 2025 at 9:14 PM Joel Jacobson <joel@compiler.org> wrote:
>
> ...
> Darn, I forgot about the edge-case where something fails in xact.c
> in between PreCommit_Notify(); and AtCommit_Notify();
> causing an abort.
>
> In this case, AtAbort_Notify() would need to undo the effect
> of the LISTEN/UNLISTEN commands that would already have been
> executed, with the 0003 patch.
>
> A normal BEGIN; LISTEN foo; ROLLBCK; is not a problem though,
> since that will never reach PreCommit_Notify().
>
> Just curious, what type of problems could cause an abort between
> PreCommit_Notify and AtCommit_Notify?
>

Serializable conflict could cause an abort after PreCommit_Notify.
0002 in [0] is an example of how it can be reproduced.

[0] https://www.postgresql.org/message-id/CAE7r3MJgJj4D_6mPHMr-4xCrYK7q04M3jM1J_=4baphjA2WeBA@mail.gmail.com


Best regards,
Arseniy Mukhin