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



##########
File path: 
core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala
##########
@@ -329,44 +352,111 @@ private[spark] class IndexShuffleBlockResolver(
           // Another attempt for the same task has already written our map 
outputs successfully,
           // so just use the existing partition lengths and delete our 
temporary map outputs.
           System.arraycopy(existingLengths, 0, lengths, 0, lengths.length)
+          if (checksumEnabled) {
+            val existingChecksums = getChecksums(checksumFileOpt.get, 
checksums.length)
+            if (existingChecksums != null) {
+              System.arraycopy(existingChecksums, 0, checksums, 0, 
lengths.length)
+            } else {
+              // It's possible that the previous task attempt succeeded 
writing the
+              // index file and data file but failed to write the checksum 
file. In
+              // this case, the current task attempt could write the missing 
checksum
+              // file by itself.
+              writeMetadataFile(checksums, checksumTmpOpt.get, 
checksumFileOpt.get, false)

Review comment:
       I did a bit more refactor here. Please take another look, thanks 
@mridulm 




-- 
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