Skip to content

Commit

Permalink
Merge pull request #10680 from nvanbenschoten/nvanbenschoten/appendAlloc
Browse files Browse the repository at this point in the history
raft: avoid allocation of Raft entry due to logging
  • Loading branch information
xiang90 authored Apr 28, 2019
2 parents 41a0d67 + 24f35a9 commit efcc108
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,11 +1005,12 @@ func stepLeader(r *raft, m pb.Message) error {
return ErrProposalDropped
}

for i, e := range m.Entries {
for i := range m.Entries {
e := &m.Entries[i]
if e.Type == pb.EntryConfChange {
if r.pendingConfIndex > r.raftLog.applied {
r.logger.Infof("propose conf %s ignored since pending unapplied configuration [index %d, applied %d]",
e.String(), r.pendingConfIndex, r.raftLog.applied)
e, r.pendingConfIndex, r.raftLog.applied)
m.Entries[i] = pb.Entry{Type: pb.EntryNormal}
} else {
r.pendingConfIndex = r.raftLog.lastIndex() + uint64(i) + 1
Expand Down

0 comments on commit efcc108

Please sign in to comment.