fix: get prevLogTerm of index zero as 0 only when firstVer is zero
This commit is contained in:
parent
704885e212
commit
03d62e478f
|
@ -74,7 +74,7 @@ SyncTerm syncLogReplMgrGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, S
|
|||
SyncTerm prevLogTerm = -1;
|
||||
terrno = TSDB_CODE_SUCCESS;
|
||||
|
||||
if (prevIndex == -1) return 0;
|
||||
if (prevIndex == -1 && pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore) == 0) return 0;
|
||||
|
||||
if (prevIndex > pBuf->matchIndex) {
|
||||
terrno = TSDB_CODE_WAL_LOG_NOT_EXIST;
|
||||
|
@ -691,7 +691,6 @@ int32_t syncLogReplMgrProcessReplyInRecoveryMode(SSyncLogReplMgr* pMgr, SSyncNod
|
|||
|
||||
if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) {
|
||||
term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1);
|
||||
|
||||
if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) {
|
||||
ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST);
|
||||
if (syncNodeStartSnapshot(pNode, &destId) < 0) {
|
||||
|
|
Loading…
Reference in New Issue