client-spark/spark2/src/main/java/org/apache/spark/shuffle/writer/RssShuffleWriter.java [308:352]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            + "], "
            + bufferManager.getManagerCostInfo());
  }

  private void checkAllBufferSpilled() {
    if (bufferManager.getBuffers().size() > 0) {
      throw new RssSendFailedException(
          "Potential data loss due to existing remaining data buffers that are not flushed. This should not happen.");
    }
  }

  private void checkSentRecordCount(long recordCount) {
    if (recordCount != bufferManager.getRecordCount()) {
      String errorMsg =
          "Potential record loss may have occurred while preparing to send blocks for task["
              + taskId
              + "]";
      throw new RssSendFailedException(errorMsg);
    }
  }

  private void checkSentBlockCount() {
    long expected = blockIds.size();
    long bufferManagerTracked = bufferManager.getBlockCount();

    if (serverToPartitionToBlockIds == null) {
      throw new RssException("serverToPartitionToBlockIds should not be null");
    }

    // to filter the multiple replica's duplicate blockIds
    Set<Long> blockIds = new HashSet<>();
    for (Map<Integer, Set<Long>> partitionBlockIds : serverToPartitionToBlockIds.values()) {
      partitionBlockIds.values().forEach(x -> blockIds.addAll(x));
    }
    long serverTracked = blockIds.size();
    if (expected != serverTracked || expected != bufferManagerTracked) {
      throw new RssSendFailedException(
          "Potential block loss may occur for task["
              + taskId
              + "]. BlockId number expected: "
              + expected
              + ", serverTracked: "
              + serverTracked
              + ", bufferManagerTracked: "
              + bufferManagerTracked);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



client-spark/spark3/src/main/java/org/apache/spark/shuffle/writer/RssShuffleWriter.java [394:438]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            + "], "
            + bufferManager.getManagerCostInfo());
  }

  private void checkAllBufferSpilled() {
    if (bufferManager.getBuffers().size() > 0) {
      throw new RssSendFailedException(
          "Potential data loss due to existing remaining data buffers that are not flushed. This should not happen.");
    }
  }

  private void checkSentRecordCount(long recordCount) {
    if (recordCount != bufferManager.getRecordCount()) {
      String errorMsg =
          "Potential record loss may have occurred while preparing to send blocks for task["
              + taskId
              + "]";
      throw new RssSendFailedException(errorMsg);
    }
  }

  private void checkSentBlockCount() {
    long expected = blockIds.size();
    long bufferManagerTracked = bufferManager.getBlockCount();

    if (serverToPartitionToBlockIds == null) {
      throw new RssException("serverToPartitionToBlockIds should not be null");
    }

    // to filter the multiple replica's duplicate blockIds
    Set<Long> blockIds = new HashSet<>();
    for (Map<Integer, Set<Long>> partitionBlockIds : serverToPartitionToBlockIds.values()) {
      partitionBlockIds.values().forEach(x -> blockIds.addAll(x));
    }
    long serverTracked = blockIds.size();
    if (expected != serverTracked || expected != bufferManagerTracked) {
      throw new RssSendFailedException(
          "Potential block loss may occur for task["
              + taskId
              + "]. BlockId number expected: "
              + expected
              + ", serverTracked: "
              + serverTracked
              + ", bufferManagerTracked: "
              + bufferManagerTracked);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



