[
https://issues.apache.org/jira/browse/RATIS-1902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774627#comment-17774627
]
Tsz-wo Sze commented on RATIS-1902:
-----------------------------------
Although the fix in RATIS-1883 was correct, the Leader should not set the next
index to the same value for INCONSISTENCY replies. Otherwise, it will have
INCONSISTENCY again.
> The snapshot index is set incorrectly in InstallSnapshotReplyProto
> ------------------------------------------------------------------
>
> Key: RATIS-1902
> URL: https://issues.apache.org/jira/browse/RATIS-1902
> Project: Ratis
> Issue Type: Bug
> Components: server
> Reporter: Tsz-wo Sze
> Assignee: Tsz-wo Sze
> Priority: Major
>
> {code}
> // 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();
> }
> {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)