code: protected AppendRequest buildAppendRequest(MemberState member, long lastIndex) {
      // If the log is empty then send an empty commit.
      // If the next index hasn't yet been set then we send an empty commit first.
      // If the next index is greater than the last index then send an empty commit.
      // If the member failed to respond to recent communication send an empty commit. This
      // helps avoid doing expensive work until we can ascertain the member is back up.
      if (context.getLog().isEmpty() || member.getNextIndex() > lastIndex || member.getFailureCount() > 0) {
        return buildAppendEmptyRequest(member);
      } else {
        return buildAppendEntriesRequest(member, lastIndex);
      }
    }
docs: Builds an append request.
  
  @param member The member to which to send the request.
  @return The append request.