mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: do not need to copy committed entries
This commit is contained in:
parent
1a677164be
commit
eaffaacf5e
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user