提交 3148df21 编写于 作者: M Minghao Li

fix(sync): compatibility for both mnode(use snapshot) and vnode(no snapshot)

上级 6ba0f160
......@@ -1215,13 +1215,14 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode) {
// update sender private term
SSyncSnapshotSender* pMySender = syncNodeGetSnapshotSender(pSyncNode, &(pSyncNode->myRaftId));
ASSERT(pMySender != NULL);
for (int i = 0; i < pSyncNode->pMatchIndex->replicaNum; ++i) {
if ((pSyncNode->senders)[i]->privateTerm > pMySender->privateTerm) {
pMySender->privateTerm = (pSyncNode->senders)[i]->privateTerm;
if (pMySender != NULL) {
for (int i = 0; i < pSyncNode->pMatchIndex->replicaNum; ++i) {
if ((pSyncNode->senders)[i]->privateTerm > pMySender->privateTerm) {
pMySender->privateTerm = (pSyncNode->senders)[i]->privateTerm;
}
}
(pMySender->privateTerm) += 100;
}
(pMySender->privateTerm) += 100;
// stop elect timer
syncNodeStopElectTimer(pSyncNode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册