From 9e9c79e311d2065afafd54572d9177efbe922577 Mon Sep 17 00:00:00 2001
From: Hou Zhijie <houzj.fnst@cn.fujitsu.com>
Date: Wed, 23 Aug 2023 13:44:12 +0800
Subject: [PATCH] Reset worker type at exit time

Commit 2a8b40e introduces the worker type field for logical replication
workers, but forgot to reset the type when the worker exits. This leads us to
possibly recognize a stopped worker as a valid logical replication worker.

---
 src/backend/replication/logical/launcher.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 72e44d5a02..48f88439d8 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -793,6 +793,7 @@ logicalrep_worker_cleanup(LogicalRepWorker *worker)
 {
 	Assert(LWLockHeldByMeInMode(LogicalRepWorkerLock, LW_EXCLUSIVE));
 
+	worker->type = WORKERTYPE_UNKNOWN;
 	worker->in_use = false;
 	worker->proc = NULL;
 	worker->dbid = InvalidOid;
-- 
2.30.0.windows.2

