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

Fix Decreasing Next Index When GrpcLogAppender Reset Client

    XMLWordPrintableJSON

Details

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

    Description

      GrpcLogAppender call `resetClient` when error accors in appending entries.

      In `resetClient`,  the new next index `nextIndex` may be match index + 1 when `request` is null.

      This will make `getFollower().decreaseNextIndex(nextIndex);` have chance to decrease next index to the value of match index, which is against that Next index should be larger than match index.

       

      // GrpcLogAppender.java:resetClient() line 134
      final long nextIndex = 1 + Optional.ofNullable(request)
          .map(AppendEntriesRequest::getPreviousLog)
          .map(TermIndex::getIndex)
          .orElseGet(f::getMatchIndex);
      if (onError && request == null) {
          LOG.warn("{}: Follower failed and request == null, " +
              " keep nextIndex ({}) unchanged and retry.", this, f.getNextIndex());
          return;
      }
      if (request != null && request.isHeartbeat()) {
          return;
      }
      
      // new next index will be min(old-1, nextIndex)
      getFollower().decreaseNextIndex(nextIndex);

       

       

      Attachments

        1. 939_review.patch
          4 kB
          Tsz-wo Sze

        Issue Links

          Activity

            People

              anpulu Anpu Lu
              anpulu Anpu Lu
              Votes:
              0 Vote for this issue
              Watchers:
              2 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 - 1h
                  1h