pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: fabio.vianello@salvagninigroup.com
To: pgsql-bugs@lists.postgresql.org
To: pgsql-hackers@lists.postgresql.org
Subject: Re: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
Date: Mon, 08 Jun 2020 17:27:30 +0900 (JST)
Message-ID: <20200608.172730.68580977059033.horikyota.ntt@gmail.com> (raw)
In-Reply-To: <16481-8bbe054e7bc0cb3c@postgresql.org>
References: <16481-8bbe054e7bc0cb3c@postgresql.org>

Hello.

It seems to me a bug.

At Fri, 05 Jun 2020 11:05:14 +0000, PG Bug reporting form <noreply@postgresql.org> wrote in 
> The following bug has been logged on the website:
> 
> Bug reference:      16481
> Logged by:          Fabio Vianello
> Email address:      fabio.vianello@salvagninigroup.com
> PostgreSQL version: 12.3
> Operating system:   Windows 10
> Description:        
> 
> About the bug BUG #15293, on PostgreSQL version 10.4 and 11.2 as describe
> below, we found the same issue on the PostgreSQL version 12.3.

The HEAD behaves the same way.

> Is it a feature? 
> Becasue in the documentation we didn't found any constraint that says that
> we can not use NOTIFY/LISTEN on logical replication tables.
> 
> "When using logical replication a stored procedure executed on the replica
> is
> unable to use NOTIFY to send messages to other listeners. The stored
> procedure does execute as expected but the pg_notify() doesn't appear to
> have any effect. If an insert is run on the replica side the trigger
> executes the stored procedure as expected and the NOTIFY correctly
> notifies
> listeners.

The message is actually queued, but logical replication worker doesn't
signal that to listener backends. If any ordinary session sent a
message to the same listener after that, both messages would be shown
at once.

That can be fixed by calling ProcessCompletedNotifies() in
apply_handle_commit. The function has a code to write out
notifications to connected clients but it doesn't nothing on logical
replication workers.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

  0001-Signal-notifications-from-logical-replication-worker.patch (text/x-patch, 0B) download

view thread (9+ messages)  latest in thread

Message-ID: <20200608.172730.68580977059033.horikyota.ntt@gmail.com>
Permalink:  ../20200608.172730.68580977059033.horikyota.ntt@gmail.com/
Also on:    postgresql.org/message-id/20200608.172730.68580977059033.horikyota.ntt@gmail.com

 ·  · 

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-bugs@postgresql.org
  Cc: horikyota.ntt@gmail.com, fabio.vianello@salvagninigroup.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
  In-Reply-To: <20200608.172730.68580977059033.horikyota.ntt@gmail.com>
  References: <16481-8bbe054e7bc0cb3c@postgresql.org> <20200608.172730.68580977059033.horikyota.ntt@gmail.com>

* 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