refactor(sync): if index less than wal.commitVer, do not truncate, otherwise it will print much log

This commit is contained in:
Minghao Li 2022-11-09 19:02:50 +08:00
parent fcc50467f4
commit fb9e62afe2
1 changed files with 6 additions and 0 deletions

View File

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