Thread: [HACKERS] inconsistent application_name use in logical workers

[HACKERS] inconsistent application_name use in logical workers

From
Peter Eisentraut
Date:
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

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

Attachment

Re: [HACKERS] inconsistent application_name use in logical workers

From
Petr Jelinek
Date:
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



Re: [HACKERS] inconsistent application_name use in logical workers

From
Peter Eisentraut
Date:
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



Re: [HACKERS] inconsistent application_name use in logical workers

From
Petr Jelinek
Date:
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



Re: [HACKERS] inconsistent application_name use in logical workers

From
Peter Eisentraut
Date:
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