raft: make if checking match the error in storage.Term
This commit is contained in:
@ -106,7 +106,7 @@ func (ms *MemoryStorage) Term(i uint64) (uint64, error) {
|
|||||||
ms.Lock()
|
ms.Lock()
|
||||||
defer ms.Unlock()
|
defer ms.Unlock()
|
||||||
offset := ms.snapshot.Metadata.Index
|
offset := ms.snapshot.Metadata.Index
|
||||||
if i < offset || i > offset+uint64(len(ms.ents)) {
|
if i < offset {
|
||||||
return 0, ErrCompacted
|
return 0, ErrCompacted
|
||||||
}
|
}
|
||||||
return ms.ents[i-offset].Term, nil
|
return ms.ents[i-offset].Term, nil
|
||||||
|
Reference in New Issue
Block a user