Merge pull request #25644 from taosdata/FIX/TD-29908-3.0

enh: check snap begin index against commit index on leader
This commit is contained in:
Hongze Cheng 2024-05-07 09:02:15 +08:00 committed by GitHub
commit 05f0253991
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -1100,6 +1100,14 @@ static int32_t syncNodeOnSnapshotPrepRsp(SSyncNode *pSyncNode, SSyncSnapshotSend
int32_t code = -1;
SSnapshot snapshot = {0};
if (pMsg->snapBeginIndex > pSyncNode->commitIndex) {
sSError(pSender,
"snapshot begin index is greater than commit index. snapBeginIndex:%" PRId64 ", commitIndex:%" PRId64,
pMsg->snapBeginIndex, pSyncNode->commitIndex);
terrno = TSDB_CODE_SYN_INVALID_SNAPSHOT_MSG;
return -1;
}
taosThreadMutexLock(&pSender->pSndBuf->mutex);
pSyncNode->pFsm->FpGetSnapshotInfo(pSyncNode->pFsm, &snapshot);