raft: make if checking match the error in storage.Term

This commit is contained in:
Yicheng Qin 2014-11-25 00:52:13 -08:00
parent 8ee1bf31d6
commit 8aa89dba3d

View File

@ -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