Re: BUG #15293: Stored Procedure Triggered by Logical Replication isUnable to use Notification Events - Mailing list pgsql-hackers

From Andres Freund
Subject Re: BUG #15293: Stored Procedure Triggered by Logical Replication isUnable to use Notification Events
Date
Msg-id 20180724192740.6yn2xregaz6yhpc2@alap3.anarazel.de
Whole thread Raw
Responses Re: BUG #15293: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
Re: BUG #15293: Stored Procedure Triggered by Logical Replication is Unable to use Notification Events
List pgsql-hackers
Hi Tom, Peter,

On 2018-07-24 21:22:18 +0300, Sergei Kornilov wrote:
> in fact, I've already tried to build fix. Adding ProcessCompletedNotifies to apply_handle_commit fixed this issue and
ithink this is right place. In src/backend/tcop/postgres.c we call ProcessCompletedNotifies similar way after commit.
Thischange pass make check-world.
 
> So i attach my two line patch.

> diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
> index 6ca6cdc..e54bd90 100644
> --- a/src/backend/replication/logical/worker.c
> +++ b/src/backend/replication/logical/worker.c
> @@ -37,6 +37,7 @@
>  
>  #include "commands/tablecmds.h"
>  #include "commands/trigger.h"
> +#include "commands/async.h"
>  
>  #include "executor/executor.h"
>  #include "executor/nodeModifyTable.h"
> @@ -490,6 +491,7 @@ apply_handle_commit(StringInfo s)
>          replorigin_session_origin_timestamp = commit_data.committime;
>  
>          CommitTransactionCommand();
> +        ProcessCompletedNotifies();
>          pgstat_report_stat(false);
>  
>          store_flush_position(commit_data.end_lsn);

That's probably reasonable for the back branches (although I'd put the
store_flush_position before).

But I wonder if we shouldn't actually move the signalling part of
ProcessCompletedNotifies() into CommitTransactionCommand() in v11. Given
that transactions can now commit without a ready command being sent, due
to the addition of procedures, that kind of seems necessary?

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] Two pass CheckDeadlock in contentent case
Next
From: matshyeq
Date:
Subject: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)