don't try to get the last log entry if there aren't any
parent
a7b0475b7d
commit
462d6e9bc7
|
@ -322,6 +322,9 @@ func (s *RaftServer) CompactLog() {
|
|||
|
||||
func (s *RaftServer) CommittedAllChanges() bool {
|
||||
entries := s.raftServer.LogEntries()
|
||||
if len(entries) == 0 {
|
||||
return false
|
||||
}
|
||||
lastIndex := entries[len(entries)-1].Index()
|
||||
return s.raftServer.CommitIndex() == lastIndex
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue