Merge pull request #18006 from taosdata/feature/3.0_mhli

refactor(sync): if index less than wal.commitVer, do not truncate, otherwise it will print much log
This commit is contained in:
Shengliang Guan 2022-11-09 21:44:18 +08:00 committed by GitHub
commit 2103df2907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -294,6 +294,12 @@ static int32_t raftLogTruncate(struct SSyncLogStore* pLogStore, SyncIndex fromIn
return 0; return 0;
} }
// need not truncate
SyncIndex walCommitVer = walGetCommittedVer(pWal);
if (fromIndex <= walCommitVer) {
return 0;
}
int32_t code = walRollback(pWal, fromIndex); int32_t code = walRollback(pWal, fromIndex);
if (code != 0) { if (code != 0) {
int32_t err = terrno; int32_t err = terrno;