Skip to content

Commit d4bfc06

Browse files
committed
Consistently use subscription name as application name
The logical replication apply worker uses the subscription name as application name, except for table sync. This was incorrectly set to use the replication slot name, which might be different, in one case. Also add a comment why the other case is different.
1 parent 9206ced commit d4bfc06

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/backend/replication/logical/tablesync.c

+5
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,11 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
817817
MySubscription->oid,
818818
MyLogicalRepWorker->relid);
819819

820+
/*
821+
* Here we use the slot name instead of the subscription name as the
822+
* application_name, so that it is different from the main apply worker,
823+
* so that synchronous replication can distinguish them.
824+
*/
820825
wrconn = walrcv_connect(MySubscription->conninfo, true, slotname, &err);
821826
if (wrconn == NULL)
822827
ereport(ERROR,

src/backend/replication/logical/worker.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ ApplyWorkerMain(Datum main_arg)
15951595
origin_startpos = replorigin_session_get_progress(false);
15961596
CommitTransactionCommand();
15971597

1598-
wrconn = walrcv_connect(MySubscription->conninfo, true, myslotname,
1598+
wrconn = walrcv_connect(MySubscription->conninfo, true, MySubscription->name,
15991599
&err);
16001600
if (wrconn == NULL)
16011601
ereport(ERROR,

0 commit comments

Comments
 (0)