This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new f5e993549 RATIS-2278. Follower Fails to Append Entries Due to Index
Validation in NavigableIndices (#1247)
f5e993549 is described below
commit f5e993549330708d85570af8462ee00c879aba2c
Author: GewuNewOne <[email protected]>
AuthorDate: Fri Apr 11 23:38:20 2025 +0800
RATIS-2278. Follower Fails to Append Entries Due to Index Validation in
NavigableIndices (#1247)
---
.../src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java
b/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java
index c5010a534..e4f661afc 100644
---
a/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java
+++
b/ratis-server/src/main/java/org/apache/ratis/server/impl/ServerImplUtils.java
@@ -141,7 +141,9 @@ public final class ServerImplUtils {
// validate startIndex
final Map.Entry<Long, ConsecutiveIndices> lastEntry = map.lastEntry();
if (lastEntry != null) {
- Preconditions.assertSame(lastEntry.getValue().getNextIndex(),
indices.startIndex, "startIndex");
+ final long nextIndex = lastEntry.getValue().getNextIndex();
+ Preconditions.assertTrue(indices.startIndex >= nextIndex,
+ () -> "startIndex = " + indices.startIndex + " < nextIndex =
" + nextIndex);
}
map.put(indices.startIndex, indices);
}