fix(sync) add multi mnodes
This commit is contained in:
parent
14c95a0b31
commit
1a22de765c
|
@ -363,28 +363,32 @@ int32_t syncNodeOnAppendEntriesCb(SSyncNode* ths, SyncAppendEntries* pMsg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ASSERT(hit == true);
|
|
||||||
|
|
||||||
|
SReConfigCbMeta cbMeta = {0};
|
||||||
bool isDrop;
|
bool isDrop;
|
||||||
syncNodeUpdateConfig(ths, &newSyncCfg, &isDrop);
|
|
||||||
|
|
||||||
// change isStandBy to normal
|
// I am in newConfig
|
||||||
if (!isDrop) {
|
if (hit) {
|
||||||
if (ths->state == TAOS_SYNC_STATE_LEADER) {
|
syncNodeUpdateConfig(ths, &newSyncCfg, &isDrop);
|
||||||
syncNodeBecomeLeader(ths);
|
|
||||||
} else {
|
// change isStandBy to normal
|
||||||
syncNodeBecomeFollower(ths);
|
if (!isDrop) {
|
||||||
|
if (ths->state == TAOS_SYNC_STATE_LEADER) {
|
||||||
|
syncNodeBecomeLeader(ths);
|
||||||
|
} else {
|
||||||
|
syncNodeBecomeFollower(ths);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* sOld = syncCfg2Str(&oldSyncCfg);
|
||||||
|
char* sNew = syncCfg2Str(&newSyncCfg);
|
||||||
|
sInfo("==config change== 0x11 old:%s new:%s isDrop:%d \n", sOld, sNew, isDrop);
|
||||||
|
taosMemoryFree(sOld);
|
||||||
|
taosMemoryFree(sNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* sOld = syncCfg2Str(&oldSyncCfg);
|
// always call FpReConfigCb
|
||||||
char* sNew = syncCfg2Str(&newSyncCfg);
|
|
||||||
sInfo("==config change== 0x11 old:%s new:%s isDrop:%d \n", sOld, sNew, isDrop);
|
|
||||||
taosMemoryFree(sOld);
|
|
||||||
taosMemoryFree(sNew);
|
|
||||||
|
|
||||||
if (ths->pFsm->FpReConfigCb != NULL) {
|
if (ths->pFsm->FpReConfigCb != NULL) {
|
||||||
SReConfigCbMeta cbMeta = {0};
|
|
||||||
cbMeta.code = 0;
|
cbMeta.code = 0;
|
||||||
cbMeta.currentTerm = ths->pRaftStore->currentTerm;
|
cbMeta.currentTerm = ths->pRaftStore->currentTerm;
|
||||||
cbMeta.index = pEntry->index;
|
cbMeta.index = pEntry->index;
|
||||||
|
|
|
@ -141,7 +141,10 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ASSERT(hit == true);
|
|
||||||
|
if (pSyncNode->state == TAOS_SYNC_STATE_LEADER) {
|
||||||
|
ASSERT(hit == true);
|
||||||
|
}
|
||||||
|
|
||||||
bool isDrop;
|
bool isDrop;
|
||||||
syncNodeUpdateConfig(pSyncNode, &newSyncCfg, &isDrop);
|
syncNodeUpdateConfig(pSyncNode, &newSyncCfg, &isDrop);
|
||||||
|
|
Loading…
Reference in New Issue