Ngone51 commented on a change in pull request #33451:
URL: https://github.com/apache/spark/pull/33451#discussion_r677451547



##########
File path: 
common/network-shuffle/src/test/java/org/apache/spark/network/shuffle/ExternalBlockHandlerSuite.java
##########
@@ -108,6 +116,107 @@ public void testCompatibilityWithOldVersion() {
     verifyOpenBlockLatencyMetrics(2, 2);
   }
 
+  private void checkDiagnosisResult(
+      String algorithm,
+      Cause expectedCaused) throws IOException {
+    String appId = "app0";
+    String execId = "execId";
+    int shuffleId = 0;
+    long mapId = 0;
+    int reduceId = 0;
+
+    // prepare the checksum file
+    File tmpDir = Files.createTempDir();
+    File checksumFile = new File(tmpDir,
+      "shuffle_" + shuffleId + "_" + mapId + "_" + reduceId + ".checksum." + 
algorithm);
+    DataOutputStream out = new DataOutputStream(new 
FileOutputStream(checksumFile));
+    long checksumByReader = 0L;
+    if (expectedCaused != Cause.UNSUPPORTED_CHECKSUM_ALGORITHM) {
+      Checksum checksum = 
ShuffleChecksumHelper.getChecksumByAlgorithm(algorithm);
+      CheckedInputStream checkedIn = new CheckedInputStream(
+        blockMarkers[0].createInputStream(), checksum);
+      byte[] buffer = new byte[10];
+      ByteStreams.readFully(checkedIn, buffer, 0, (int) 
blockMarkers[0].size());
+      long checksumByWriter = checkedIn.getChecksum().getValue();
+
+      switch (expectedCaused) {
+        case DISK_ISSUE:
+          out.writeLong(-checksumByWriter);
+          checksumByReader = checksumByWriter;
+          break;

Review comment:
       Sorry. I don't get this. Do you mean we try write the `MIN_VALUE` 
instead of `-checksumByWriter`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to