diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 6e55d2d606..6fe39d2023 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -817,6 +817,11 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) MySubscription->oid, MyLogicalRepWorker->relid); + /* + * Here we use the slot name instead of the subscription name as the + * application_name, so that it is different from the main apply worker, + * so that synchronous replication can distinguish them. + */ wrconn = walrcv_connect(MySubscription->conninfo, true, slotname, &err); if (wrconn == NULL) ereport(ERROR, diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 999d627c87..6ba70773bf 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, &err); if (wrconn == NULL) ereport(ERROR,