Skip to content

Commit

Permalink
Applied check as Always assertion instead
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed May 28, 2024
1 parent 93c25a8 commit ab97579
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,16 @@ func (n *raft) Applied(index uint64) (entries uint64, bytes uint64) {
}

// Ignore if already applied.
if index > n.applied {
n.applied = index
} else {
assert.Unreachable("New applied is equal or lower than existing applied index", map[string]any{
assert.Always(
index > n.applied,
"New applied is equal or lower than existing applied index",
map[string]any{
"new_applied_index": index,
"applied_index": n.applied,
})

},
)
if index > n.applied {
n.applied = index
}

// Calculate the number of entries and estimate the byte size that
Expand Down

0 comments on commit ab97579

Please sign in to comment.