code: protected void updateNextIndex(MemberState member, AppendRequest request) {
      // If the match index was set, update the next index to be greater than the match index if necessary.
      if (!request.entries().isEmpty()) {
        member.setNextIndex(request.entries().get(request.entries().size()-1).getIndex()+1);
      }
    }
docs: Updates the next index when the match index is updated.