fix: set restore finish only after reaching the current term
This commit is contained in:
parent
5159d60f56
commit
7227e53b98
|
@ -558,7 +558,8 @@ int32_t syncLogBufferCommit(SSyncLogBuffer* pBuf, SSyncNode* pNode, int64_t comm
|
||||||
ret = 0;
|
ret = 0;
|
||||||
_out:
|
_out:
|
||||||
// mark as restored if needed
|
// mark as restored if needed
|
||||||
if (!pNode->restoreFinish && pBuf->commitIndex >= pNode->commitIndex) {
|
if (!pNode->restoreFinish && pBuf->commitIndex >= pNode->commitIndex && pEntry != NULL &&
|
||||||
|
pNode->pRaftStore->currentTerm <= pEntry->term) {
|
||||||
pNode->pFsm->FpRestoreFinishCb(pNode->pFsm);
|
pNode->pFsm->FpRestoreFinishCb(pNode->pFsm);
|
||||||
pNode->restoreFinish = true;
|
pNode->restoreFinish = true;
|
||||||
sInfo("vgId:%d, restore finished. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId,
|
sInfo("vgId:%d, restore finished. log buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId,
|
||||||
|
|
Loading…
Reference in New Issue