Merge pull request #1035 from coreos/no_copy

raft: do not need to copy committed entries
release-2.0
Xiang Li 2014-09-09 16:07:20 -07:00
commit 68aa114301
1 changed files with 1 additions and 7 deletions

View File

@ -94,13 +94,7 @@ func (l *raftLog) resetUnstable() {
// all the returned entries will be marked as applied.
func (l *raftLog) nextEnts() (ents []pb.Entry) {
if l.committed > l.applied {
ents := l.slice(l.applied+1, l.committed+1)
if ents == nil {
return nil
}
cpy := make([]pb.Entry, len(ents))
copy(cpy, ents)
return cpy
return l.slice(l.applied+1, l.committed+1)
}
return nil
}