From fc959737c31938cb664487c0cee617b29914a490 Mon Sep 17 00:00:00 2001
From: Hou <houzj.fnst@fujitsu.com>
Date: Tue, 24 Jan 2023 10:38:48 +0800
Subject: [PATCH] Take last_start_dsh as dsa_pointer

---
 src/backend/replication/logical/launcher.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 564bffe5ca..f50eea60a2 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -923,7 +923,7 @@ ApplyLauncherShmemInit(void)
 		memset(LogicalRepCtx, 0, ApplyLauncherShmemSize());
 
 		LogicalRepCtx->last_start_dsa = DSM_HANDLE_INVALID;
-		LogicalRepCtx->last_start_dsh = DSM_HANDLE_INVALID;
+		LogicalRepCtx->last_start_dsh = InvalidDsaPointer;
 
 		/* Initialize memory and spin locks for each worker slot. */
 		for (slot = 0; slot < max_logical_replication_workers; slot++)
@@ -947,7 +947,7 @@ logicalrep_launcher_attach_dshmem(void)
 	MemoryContext oldcontext;
 
 	/* Quick exit if we already did this. */
-	if (LogicalRepCtx->last_start_dsh != DSM_HANDLE_INVALID &&
+	if (DsaPointerIsValid(LogicalRepCtx->last_start_dsh) &&
 		last_start_times != NULL)
 		return;
 
@@ -957,7 +957,7 @@ logicalrep_launcher_attach_dshmem(void)
 	/* Be sure any local memory allocated by DSA routines is persistent. */
 	oldcontext = MemoryContextSwitchTo(TopMemoryContext);
 
-	if (LogicalRepCtx->last_start_dsh == DSM_HANDLE_INVALID)
+	if (!DsaPointerIsValid(LogicalRepCtx->last_start_dsh))
 	{
 		/* Initialize dynamic shared hash table for last-start times. */
 		last_start_times_dsa = dsa_create(LWTRANCHE_LAUNCHER_DSA);
-- 
2.28.0.windows.1

