inconsistent application_name use in logical workers

Started by Peter Eisentrautover 9 years ago5 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36861
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 06:28 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t36861_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t36861_1 && git checkout t36861_1

Patchset v1 (message #1) is on t36861_1

Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

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

Attachments:

t36861_1
0001-Consistently-use-subscription-name-as-application-na.patchtext/plain; charset=UTF-8; name=0001-Consistently-use-subscription-name-as-application-na.patch; x-mac-creator=0; x-mac-type=0Download+2-3
#2Petr Jelinek
petr@2ndquadrant.com
In reply to: Peter Eisentraut (#1)
Re: inconsistent application_name use in logical workers

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

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Petr Jelinek (#2)
Re: inconsistent application_name use in logical workers

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

#4Petr Jelinek
petr@2ndquadrant.com
In reply to: Peter Eisentraut (#3)
Re: inconsistent application_name use in logical workers

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

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Petr Jelinek (#4)
Re: inconsistent application_name use in logical workers

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