diff --git a/raft/log.go b/raft/log.go index 83dcb662c..e626385d5 100644 --- a/raft/log.go +++ b/raft/log.go @@ -339,7 +339,7 @@ func (l *raftLog) mustCheckOutOfBounds(lo, hi uint64) error { return ErrCompacted } - length := l.lastIndex() - fi + 1 + length := l.lastIndex() + 1 - fi if lo < fi || hi > fi+length { l.logger.Panicf("slice[%d,%d) out of bound [%d,%d]", lo, hi, fi, l.lastIndex()) }