!3539 修复发布端主备切换后,订阅端无法自动连接到新主的问题
Merge pull request !3539 from pengjiong/fix_date
This commit is contained in:
@ -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)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user