!102 【轻量级 PR】:灾备集群不走双主双重启逻辑

Merge pull request !102 from zhouwenbin_db/N/A
This commit is contained in:
opengauss-bot 2023-03-02 07:57:40 +00:00 committed by Gitee
commit d86cf089c2
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -405,6 +405,14 @@ static void GetDnStaticRoleFromDdb(const DnArbCtx *ctx)
} else {
GetDatanodeDynamicConfigChangeFromDdb(ctx->groupIdx);
}
if (g_needIncTermToDdbAgain) {
(void)pthread_rwlock_wrlock(&term_update_rwlock);
/* Prevent multiple worker threads from increasing term at the same time. */
if (g_needIncTermToDdbAgain) {
(void)IncrementTermToDdb();
}
(void)pthread_rwlock_unlock(&term_update_rwlock);
}
}
static void ResetHeartbeat(const DnArbCtx *ctx)
@ -1463,7 +1471,9 @@ static bool MoreDyPrimary(DnArbCtx *ctx, const char *typeName)
if (ctx->cond.igPrimaryCount >= 1 && ctx->instId != ctx->repGroup->lastFailoverDn) {
SendRestartMsg(ctx, typeName);
write_runlog(LOG, "Dynamic primary %u is not last failover dn, restart to cascade_standby.\n", ctx->instId);
return true;
}
return false;
}
/* restart dn instance */