灾备集群不走双主双重启逻辑

This commit is contained in:
zhouwenbin_db 2023-03-02 01:37:40 +00:00 committed by Gitee
parent fbdf9656b3
commit c5b6f16387
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -404,6 +404,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)
@ -1436,7 +1444,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 */