raft: simplify raftLog.lastIndex

release-2.0
Yicheng Qin 2014-11-24 23:08:51 -08:00
parent 8670f4012b
commit 7fcaca6d18
1 changed files with 1 additions and 8 deletions

View File

@ -158,14 +158,7 @@ func (l *raftLog) firstIndex() uint64 {
}
func (l *raftLog) lastIndex() uint64 {
if len(l.unstableEnts) > 0 {
return l.unstable + uint64(len(l.unstableEnts)) - 1
}
index, err := l.storage.LastIndex()
if err != nil {
panic(err) // TODO(bdarnell)
}
return index
return l.unstable + uint64(len(l.unstableEnts)) - 1
}
func (l *raftLog) commitTo(tocommit uint64) {