Explorar el Código

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

Yicheng Qin hace 11 años
padre
commit
8aa89dba3d
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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()
 	defer ms.Unlock()
 	offset := ms.snapshot.Metadata.Index
-	if i < offset || i > offset+uint64(len(ms.ents)) {
+	if i < offset {
 		return 0, ErrCompacted
 	}
 	return ms.ents[i-offset].Term, nil