aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-06-06 21:51:31 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-06-06 22:11:22 -0400
commitd4bfc06e292ee2f537f42d4ed216209c4537ee92 (patch)
tree517c83e5e1ece52a3f111df870e68f74b09343b7 /src
parent9206ced1dc05d3a9cc99faafa22d5d8b16d998d1 (diff)
downloadpostgresql-d4bfc06e292ee2f537f42d4ed216209c4537ee92.tar.gz
postgresql-d4bfc06e292ee2f537f42d4ed216209c4537ee92.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/logical/tablesync.c5
-rw-r--r--src/backend/replication/logical/worker.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 6e55d2d6069..6fe39d20237 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 999d627c872..6ba70773bfd 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,