mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
raft: use max in log.slice
This commit is contained in:
parent
9ddd8ee539
commit
bdbafe2cf3
@ -285,12 +285,7 @@ func (l *raftLog) slice(lo uint64, hi uint64) []pb.Entry {
|
||||
ents = append(ents, storedEnts...)
|
||||
}
|
||||
if len(l.unstableEnts) > 0 && hi > l.unstable {
|
||||
var firstUnstable uint64
|
||||
if lo < l.unstable {
|
||||
firstUnstable = l.unstable
|
||||
} else {
|
||||
firstUnstable = lo
|
||||
}
|
||||
firstUnstable := max(lo, l.unstable)
|
||||
ents = append(ents, l.unstableEnts[firstUnstable-l.unstable:hi-l.unstable]...)
|
||||
}
|
||||
return ents
|
||||
|
Loading…
x
Reference in New Issue
Block a user