Re: [HACKERS] inconsistent application_name use in logical workers

2017-06-06 Thread Peter Eisentraut
On 6/6/17 13:24, Petr Jelinek wrote:
> On 06/06/17 15:07, Peter Eisentraut wrote:
>> On 6/6/17 06:51, Petr Jelinek wrote:
>>> On 06/06/17 04:19, Peter Eisentraut wrote:
 The logical replication code is supposed to use the subscription name as
 the fallback_application_name, but in some cases it uses the slot name,
 which could be different.  See attached patch to correct this.
>>>
>>> Hmm, well the differentiation has a reason though. The application_name
>>> is used for sync rep and having synchronization connection using same
>>> application_name might have adverse effects there because
>>> synchronization connection can be in-front of main apply one, so sync
>>> rep will think something is consumed while it's not.
>>
>> True, we should use a different name for tablesync.c.  But the one in
>> worker.c appears to be a mistake then?
> 
> Yes.

Committed and added a comment.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] inconsistent application_name use in logical workers

2017-06-06 Thread Petr Jelinek
On 06/06/17 15:07, Peter Eisentraut wrote:
> On 6/6/17 06:51, Petr Jelinek wrote:
>> On 06/06/17 04:19, Peter Eisentraut wrote:
>>> The logical replication code is supposed to use the subscription name as
>>> the fallback_application_name, but in some cases it uses the slot name,
>>> which could be different.  See attached patch to correct this.
>>
>> Hmm, well the differentiation has a reason though. The application_name
>> is used for sync rep and having synchronization connection using same
>> application_name might have adverse effects there because
>> synchronization connection can be in-front of main apply one, so sync
>> rep will think something is consumed while it's not.
> 
> True, we should use a different name for tablesync.c.  But the one in
> worker.c appears to be a mistake then?
> 

Yes.

-- 
  Petr Jelinek  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] inconsistent application_name use in logical workers

2017-06-06 Thread Peter Eisentraut
On 6/6/17 06:51, Petr Jelinek wrote:
> On 06/06/17 04:19, Peter Eisentraut wrote:
>> The logical replication code is supposed to use the subscription name as
>> the fallback_application_name, but in some cases it uses the slot name,
>> which could be different.  See attached patch to correct this.
> 
> Hmm, well the differentiation has a reason though. The application_name
> is used for sync rep and having synchronization connection using same
> application_name might have adverse effects there because
> synchronization connection can be in-front of main apply one, so sync
> rep will think something is consumed while it's not.

True, we should use a different name for tablesync.c.  But the one in
worker.c appears to be a mistake then?

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] inconsistent application_name use in logical workers

2017-06-06 Thread Petr Jelinek
On 06/06/17 04:19, Peter Eisentraut wrote:
> The logical replication code is supposed to use the subscription name as
> the fallback_application_name, but in some cases it uses the slot name,
> which could be different.  See attached patch to correct this.
> 

Hmm, well the differentiation has a reason though. The application_name
is used for sync rep and having synchronization connection using same
application_name might have adverse effects there because
synchronization connection can be in-front of main apply one, so sync
rep will think something is consumed while it's not.

-- 
  Petr Jelinek  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] inconsistent application_name use in logical workers

2017-06-05 Thread Peter Eisentraut
The logical replication code is supposed to use the subscription name as
the fallback_application_name, but in some cases it uses the slot name,
which could be different.  See attached patch to correct this.

-- 
Peter Eisentraut  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From d134d4eae3bd176e10e418746202e69e3f6e7e28 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut 
Date: Mon, 5 Jun 2017 22:14:40 -0400
Subject: [PATCH] Consistently use subscription name as application name

---
 src/backend/replication/logical/tablesync.c | 2 +-
 src/backend/replication/logical/worker.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/replication/logical/tablesync.c 
b/src/backend/replication/logical/tablesync.c
index 6e268f3521..e8540f291c 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -800,7 +800,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
MySubscription->oid,
MyLogicalRepWorker->relid);
 
-   wrconn = walrcv_connect(MySubscription->conninfo, true, slotname, );
+   wrconn = walrcv_connect(MySubscription->conninfo, true, 
MySubscription->name, );
if (wrconn == NULL)
ereport(ERROR,
(errmsg("could not connect to the publisher: 
%s", err)));
diff --git a/src/backend/replication/logical/worker.c 
b/src/backend/replication/logical/worker.c
index a570900a42..b87b6921c0 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1595,7 +1595,7 @@ ApplyWorkerMain(Datum main_arg)
origin_startpos = replorigin_session_get_progress(false);
CommitTransactionCommand();
 
-   wrconn = walrcv_connect(MySubscription->conninfo, true, 
myslotname,
+   wrconn = walrcv_connect(MySubscription->conninfo, true, 
MySubscription->name,
);
if (wrconn == NULL)
ereport(ERROR,
-- 
2.13.1


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers