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

    https://github.com/apache/spark/pull/15814#discussion_r87138232
  
    --- Diff: 
core/src/main/scala/org/apache/spark/internal/io/HadoopMapReduceCommitProtocol.scala
 ---
    @@ -87,25 +120,40 @@ class HadoopMapReduceCommitProtocol(jobId: String, 
path: String)
     
       override def commitJob(jobContext: JobContext, taskCommits: 
Seq[TaskCommitMessage]): Unit = {
         committer.commitJob(jobContext)
    +    val filesToMove = taskCommits.map(_.obj.asInstanceOf[Map[String, 
String]]).reduce(_ ++ _)
    +    logDebug(s"Committing files staged for absolute locations 
$filesToMove")
    +    val fs = absPathStagingDir.getFileSystem(jobContext.getConfiguration)
    +    for ((src, dst) <- filesToMove) {
    +      fs.rename(new Path(src), new Path(dst))
    +    }
    +    fs.delete(absPathStagingDir, true)
       }
     
       override def abortJob(jobContext: JobContext): Unit = {
         committer.abortJob(jobContext, JobStatus.State.FAILED)
    +    val fs = absPathStagingDir.getFileSystem(jobContext.getConfiguration)
    +    fs.delete(absPathStagingDir, true)
       }
     
       override def setupTask(taskContext: TaskAttemptContext): Unit = {
         committer = setupCommitter(taskContext)
         committer.setupTask(taskContext)
    +    addedAbsPathFiles = mutable.Map[String, String]()
       }
     
       override def commitTask(taskContext: TaskAttemptContext): 
TaskCommitMessage = {
         val attemptId = taskContext.getTaskAttemptID
         SparkHadoopMapRedUtil.commitTask(
           committer, taskContext, attemptId.getJobID.getId, 
attemptId.getTaskID.getId)
    -    EmptyTaskCommitMessage
    +    new TaskCommitMessage(addedAbsPathFiles.toMap)
    --- End diff --
    
    Yea it can go either way. Unclear which one is better. Renaming on job 
commit gives higher chance of corrupting data, whereas renaming in task commit 
is slightly more performant.



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to