Skip to content

Commit

Permalink
Merge pull request #14539 from nvanbenschoten/nvanbenschoten/advanceH…
Browse files Browse the repository at this point in the history
…ardState

raft: update prevHardSt on Ready accept, not advance
  • Loading branch information
ahrtr authored Sep 30, 2022
2 parents c102c07 + 9a03632 commit a932fb5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions raft/rawnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func (rn *RawNode) acceptReady(rd Ready) {
if rd.SoftState != nil {
rn.prevSoftSt = rd.SoftState
}
if !IsEmptyHardState(rd.HardState) {
rn.prevHardSt = rd.HardState
}
if len(rd.ReadStates) != 0 {
rn.raft.readStates = nil
}
Expand Down Expand Up @@ -172,9 +175,6 @@ func (rn *RawNode) HasReady() bool {
// Advance notifies the RawNode that the application has applied and saved progress in the
// last Ready results.
func (rn *RawNode) Advance(rd Ready) {
if !IsEmptyHardState(rd.HardState) {
rn.prevHardSt = rd.HardState
}
rn.raft.advance(rd)
}

Expand Down

0 comments on commit a932fb5

Please sign in to comment.