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 72c060d9c RATIS-2045. SnapshotInstallationHandler doesn't notify 
follower when snapshotIndex is -1 and firstAvailableLogIndex is 0 (#1053)
72c060d9c is described below

commit 72c060d9cc524045ce55e830db070c5514f23ed4
Author: Hemant Kumar <[email protected]>
AuthorDate: Wed Mar 20 16:26:43 2024 -0700

    RATIS-2045. SnapshotInstallationHandler doesn't notify follower when 
snapshotIndex is -1 and firstAvailableLogIndex is 0 (#1053)
---
 .../java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java
 
b/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java
index 3e5ac2b67..f03e2d883 100644
--- 
a/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java
+++ 
b/ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java
@@ -221,7 +221,8 @@ class SnapshotInstallationHandler {
         // Check if snapshot index is already at par or ahead of the first
         // available log index of the Leader.
         final long snapshotIndex = state.getLog().getSnapshotIndex();
-        if (snapshotIndex + 1 >= firstAvailableLogIndex && 
firstAvailableLogIndex > INVALID_LOG_INDEX) {
+        if (snapshotIndex != INVALID_LOG_INDEX && snapshotIndex + 1 >= 
firstAvailableLogIndex &&
+            firstAvailableLogIndex > INVALID_LOG_INDEX) {
           // State Machine has already installed the snapshot. Return the
           // latest snapshot index to the Leader.
 

Reply via email to