mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: make if checking match the error in storage.Term
This commit is contained in:
parent
8ee1bf31d6
commit
8aa89dba3d
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user