Skip to content

Commit f5e9935

Browse files
authored
RATIS-2278. Follower Fails to Append Entries Due to Index Validation in NavigableIndices (#1247)
1 parent 7be7cb8 commit f5e9935

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ synchronized void append(List<ConsecutiveIndices> entriesTermIndices) {
141141
// validate startIndex
142142
final Map.Entry<Long, ConsecutiveIndices> lastEntry = map.lastEntry();
143143
if (lastEntry != null) {
144-
Preconditions.assertSame(lastEntry.getValue().getNextIndex(), indices.startIndex, "startIndex");
144+
final long nextIndex = lastEntry.getValue().getNextIndex();
145+
Preconditions.assertTrue(indices.startIndex >= nextIndex,
146+
() -> "startIndex = " + indices.startIndex + " < nextIndex = " + nextIndex);
145147
}
146148
map.put(indices.startIndex, indices);
147149
}

0 commit comments

Comments
 (0)