Commit282b1cde9made SignalBackends() ignore ListenerEntry entries whose "listening" flag said that the listener was not yet committed. That will be true for a new listener that has already registered its queue position, but has not yet reached AtCommit_Notify(). If another backend notifies the same channel in that window, SignalBackends() would directly advance the new listener's queue position, causing it to miss message(s). Really this is a definitional question: is a new listener active as of PreCommit, or as of AtCommit? But it seems to make more sense to expect that the new listener will see all messages after its initially-registered queue position, especially since the direct-advance logic is supposed to be an optimization that doesn't affect semantics. Fix this by treating all channel entries as valid wakeup targets. Rename the "listening" flag to removeOnAbort to reflect its remaining purpose: identifying staged LISTEN entries that abort cleanup must remove. While we're here, remove an obsolete test case added by282b1cde9. The check for "ChannelHashAddListener array growth" was meant to exercise code that never made it into the committed patch, so now it's just a waste of test cycles. Author: Joel Jacobson <joel@compiler.org> Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/9835b0a4-9121-47ac-9c44-427b8b1a7f1b@app.fastmail.com Discussion: https://postgr.es/m/6fe5ee75-537d-4d4f-909a-b21303c3ce75@app.fastmail.com
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.