pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Stabilize NOTIFY behavior by transmitting notifies before ReadyF
Date: Sun, 24 Nov 2019 19:43:19 +0000
Message-ID: <E1iYxmx-00086y-Ta@gemulon.postgresql.org> (raw)

Stabilize NOTIFY behavior by transmitting notifies before ReadyForQuery.

This patch ensures that, if any notify messages were received during
a just-finished transaction, they get sent to the frontend just before
not just after the ReadyForQuery message.  With libpq and other client
libraries that act similarly, this guarantees that the client will see
the notify messages as available as soon as it thinks the transaction
is done.

This probably makes no difference in practice, since in realistic
use-cases the application would have to cope with asynchronous
arrival of notify events anyhow.  However, it makes it a lot easier
to build cross-session-notify test cases with stable behavior.
I'm a bit surprised now that we've not seen any buildfarm instability
with the test cases added by commit b10f40bf0.  Tests that I intend
to add in an upcoming bug fix are definitely unstable without this.

Back-patch to 9.6, which is as far back as we can do NOTIFY testing
with the isolationtester infrastructure.

Discussion: https://postgr.es/m/13881.1574557302@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7900269724424b6deca516eba3dd8e4bf6621bea

Modified Files
--------------
src/backend/commands/async.c | 12 +++++++-----
src/backend/tcop/postgres.c  | 11 +++++++++++
2 files changed, 18 insertions(+), 5 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1iYxmx-00086y-Ta@gemulon.postgresql.org>
Permalink:  ../E1iYxmx-00086y-Ta@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iYxmx-00086y-Ta@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Stabilize NOTIFY behavior by transmitting notifies before ReadyF
  In-Reply-To: <E1iYxmx-00086y-Ta@gemulon.postgresql.org>
  References: <E1iYxmx-00086y-Ta@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox