From ab97579807547a88e56d06e6ec75b25e74ef8b54 Mon Sep 17 00:00:00 2001 From: Neil Twigg Date: Tue, 28 May 2024 15:07:04 +0100 Subject: [PATCH] Applied check as Always assertion instead --- server/raft.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/raft.go b/server/raft.go index 62995f717fb..80db17b639a 100644 --- a/server/raft.go +++ b/server/raft.go @@ -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