diff --git a/src/gausskernel/process/threadpool/knl_thread.cpp b/src/gausskernel/process/threadpool/knl_thread.cpp index 13d33ffe96e4508c231d11775ce56d34688483cb..9a05640bc80f9fb376f90bd74db97591dfc50a4f 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 2824d5320a15213b5f2f127ced47d00c280f24fc..8cb9a6a06283fc649b1d770fe8045760594a4162 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 979580bfbf429ec6132ce493f040fbb511103bf1..d5dae41e2f3e3ea81af2e91bd02895b14745a0b4 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 {