diff --git a/src/gausskernel/process/threadpool/knl_thread.cpp b/src/gausskernel/process/threadpool/knl_thread.cpp index 13d33ffe9..9a05640bc 100755 --- a/src/gausskernel/process/threadpool/knl_thread.cpp +++ b/src/gausskernel/process/threadpool/knl_thread.cpp @@ -1084,6 +1084,7 @@ static void KnlTPublicationInit(knl_t_publication_context* publicationCxt) publicationCxt->publications_valid = false; publicationCxt->RelationSyncCache = NULL; publicationCxt->updateConninfoNeeded = false; + publicationCxt->firstTimeSendConninfo = false; } static void KnlTUndolauncherInit(knl_t_undolauncher_context* undolauncherCxt) diff --git a/src/gausskernel/storage/replication/pgoutput/pgoutput.cpp b/src/gausskernel/storage/replication/pgoutput/pgoutput.cpp index 2824d5320..8cb9a6a06 100644 --- a/src/gausskernel/storage/replication/pgoutput/pgoutput.cpp +++ b/src/gausskernel/storage/replication/pgoutput/pgoutput.cpp @@ -178,6 +178,7 @@ static void pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *o if (data->protocol_version >= LOGICALREP_CONNINFO_PROTO_VERSION_NUM) { t_thrd.publication_cxt.updateConninfoNeeded = true; } + t_thrd.publication_cxt.firstTimeSendConninfo = true; CacheRegisterThreadSyscacheCallback(PUBLICATIONOID, publication_invalidation_cb, (Datum)0); /* Initialize relation schema cache. */ @@ -235,7 +236,8 @@ static void pgoutput_commit_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *t * Send the newest connecttion information to the subscriber, * when the connection information about the standby changes. */ - if (t_thrd.publication_cxt.updateConninfoNeeded && ReplconninfoChanged()) { + if ((t_thrd.publication_cxt.updateConninfoNeeded && ReplconninfoChanged()) || + t_thrd.publication_cxt.firstTimeSendConninfo) { StringInfoData standbysInfo; initStringInfo(&standbysInfo); @@ -245,6 +247,7 @@ static void pgoutput_commit_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *t OutputPluginWrite(ctx, true); FreeStringInfo(&standbysInfo); + t_thrd.publication_cxt.firstTimeSendConninfo = false; } } diff --git a/src/include/knl/knl_thread.h b/src/include/knl/knl_thread.h index 979580bfb..d5dae41e2 100755 --- a/src/include/knl/knl_thread.h +++ b/src/include/knl/knl_thread.h @@ -3339,6 +3339,7 @@ typedef struct knl_t_publication_context { /* Map used to remember which relation schemas we sent. */ HTAB* RelationSyncCache; bool updateConninfoNeeded; + bool firstTimeSendConninfo; } knl_t_publication_context; typedef struct knl_t_dms_context {