Re: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: euler(dot)taveira(at)2ndquadrant(dot)com
Cc: fabio(dot)vianello(at)salvagninigroup(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
Date: 2020-06-09 06:09:21
Message-ID: 20200609.150921.2296867674612794898.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello, Euler.

At Mon, 8 Jun 2020 07:51:18 -0300, Euler Taveira <euler(dot)taveira(at)2ndquadrant(dot)com> wrote in
> On Mon, 8 Jun 2020 at 05:27, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
> wrote:
>
> >
> > 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.
> >
> >
> This bug was already reported some time ago (#15293) but it slipped through
> the
> cracks. I don't think you should simply call ProcessCompletedNotifies [1].

Yeah, Thanks for pointing that. I faintly thought of a similar thing
to the discussion there. Just calling ProcessCompletedNotifies in
apply_handle_commit is actually wrong.

We can move only SignalBackends() to AtCommit_Notify since
asyncQueueAdvanceTail() is no longer dependent on the result of
SignalBackends, but anyway we need to call asyncQueueAdvanceTail in
AtCommit_Notify and AtAbort_Notify since otherwise the queue cannot be
shorten while running logical replication. This can slightly defers
tail-advancing but I think it wouldn't be a significant problem.

> [1] https://www.postgresql.org/message-id/13844.1532468610%40sss.pgh.pa.us

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
v2-0001-Fix-notification-signaling.patch text/x-patch 6.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Felix Geisendörfer 2020-06-09 06:21:29 Re: BUG #16487: EXPLAIN produces JSON with duplicate "Workers" arrays
Previous Message Vianello Fabio 2020-06-09 05:59:04 RE: BUG #16481: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-06-09 06:11:04 Re: Read access for pg_monitor to pg_replication_origin_status view
Previous Message Andres Freund 2020-06-09 06:08:47 Re: Atomic operations within spinlocks