]> granicus.if.org Git - postgresql/commitdiff
Consistently use subscription name as application name
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 7 Jun 2017 01:51:31 +0000 (21:51 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 7 Jun 2017 02:11:22 +0000 (22:11 -0400)
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.

src/backend/replication/logical/tablesync.c
src/backend/replication/logical/worker.c

index 6e55d2d606950a1738bd17c180c29fff188d6406..6fe39d20237d3956819b3da64ffc997df21cd5bc 100644 (file)
@@ -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,
index 999d627c87205629c3c7e3ac784dd7abe22a5f5d..6ba70773bfd960b54ae1c753d76009d441cfc68d 100644 (file)
@@ -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,