Description
// ServerProtoUtils.java static InstallSnapshotReplyProto toInstallSnapshotReplyProto( RaftPeerId requestorId, RaftGroupMemberId replyId, long currentTerm, InstallSnapshotResult result, long installedSnapshotIndex) { final RaftRpcReplyProto.Builder rb = toRaftRpcReplyProtoBuilder(requestorId, replyId, isSuccess(result)); final InstallSnapshotReplyProto.Builder builder = InstallSnapshotReplyProto .newBuilder().setServerReply(rb).setTerm(currentTerm).setResult(result); if (installedSnapshotIndex > 0) { builder.setSnapshotIndex(installedSnapshotIndex); } return builder.build(); }
In the code above, the condition installedSnapshotIndex > 0 above is invalid since it cannot be set to RaftLog.INVALID_LOG_INDEX (== -1). When the log is empty and there is no snapshots, it is correct for a follower replying RaftLog.INVALID_LOG_INDEX.
Attachments
Issue Links
- causes
-
RATIS-1920 NPE in AppendLogResponseHandler
- Resolved
- relates to
-
RATIS-1883 Next Index should be always larger than Match Index in GrpcLogAppender
- Resolved
- links to