From f8c891e232da418c8bca614ea5a6825a6ed55e08 Mon Sep 17 00:00:00 2001 From: Hayato Kuroda Date: Wed, 28 Jun 2023 06:19:34 +0000 Subject: [PATCH v2 6/6] Use slot name as application_name again --- src/backend/replication/logical/tablesync.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index e2b535f920..9728541acf 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -1382,23 +1382,14 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos, int worker_slot) */ if (LogRepWorkerWalRcvConn == NULL) { - char application_name[NAMEDATALEN]; - /* - * FIXME: set appropriate application_name. Previously, the slot name - * was used becasue the lifetime of the tablesync worker was same as - * that, but now the tablesync worker handles many slots during the - * synchronization so that it is not suitable. So what should be? - * Note that if the tablesync worker starts to reuse the replication - * slot during synchronization, we should use the slot name as - * application_name again. + * Here we use the slot name instead of the subscription name as the + * application_name, */ - snprintf(application_name, NAMEDATALEN, "pg_%u_sync_%i", - MySubscription->oid, worker_slot); LogRepWorkerWalRcvConn = walrcv_connect(MySubscription->conninfo, true, must_use_password, - application_name, &err); + slotname, &err); } if (LogRepWorkerWalRcvConn == NULL) -- 2.27.0