mridulm commented on a change in pull request #33451:
URL: https://github.com/apache/spark/pull/33451#discussion_r677644226
##########
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:
`- MIN_VALUE` == `MIN_VALUE` :-)
Ditto for `0` - these are two cases where a neg will not change value : and
so we would end up with test failures (if for some input/algo combination,
`checksumWriter` ended up being these values).
Same in `NETWORK_ISSUE` below.
--
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]