Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9610#discussion_r44499655
  
    --- Diff: 
core/src/main/scala/org/apache/spark/shuffle/hash/HashShuffleWriter.scala ---
    @@ -106,6 +108,19 @@ private[spark] class HashShuffleWriter[K, V](
           writer.commitAndClose()
           writer.fileSegment().length
         }
    +    // rename all shuffle files to final paths
    +    shuffle.writers.zip(sizes).foreach { case (writer: 
DiskBlockObjectWriter, size: Long) =>
    +      if (size > 0) {
    +        val output = blockManager.diskBlockManager.getFile(writer.blockId)
    +        if (output.exists()) {
    +          writer.file.delete()
    +        } else {
    +          if (!writer.file.renameTo(output)) {
    +            throw new IOException(s"fail to rename ${writer.file} to 
$output")
    --- End diff --
    
    The `size` here is used to make sure that a new file is generated (we could 
try to delete existed file if size is 0). 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to