Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1902

The snapshot index is set incorrectly in InstallSnapshotReplyProto

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0
    • server
    • None

    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

          Activity

            People

              szetszwo Tsz-wo Sze
              szetszwo Tsz-wo Sze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m