Browse Source

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

Yicheng Qin 11 years ago
parent
commit
8aa89dba3d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      raft/storage.go

+ 1 - 1
raft/storage.go

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