turboFei commented on a change in pull request #26339:
[SPARK-27194][SPARK-29302][SQL] Fix the issue that for dynamic partition
overwrite a task would conflict with its speculative task
URL: https://github.com/apache/spark/pull/26339#discussion_r407837974
##########
File path:
core/src/main/scala/org/apache/spark/internal/io/HadoopMapReduceCommitProtocol.scala
##########
@@ -236,13 +267,25 @@ class HadoopMapReduceCommitProtocol(
committer.setupTask(taskContext)
addedAbsPathFiles = mutable.Map[String, String]()
partitionPaths = mutable.Set[String]()
+ dynamicStagingTaskFiles = mutable.Set[Path]()
}
override def commitTask(taskContext: TaskAttemptContext): TaskCommitMessage
= {
val attemptId = taskContext.getTaskAttemptID
logTrace(s"Commit task ${attemptId}")
SparkHadoopMapRedUtil.commitTask(
committer, taskContext, attemptId.getJobID.getId,
attemptId.getTaskID.getId)
+ if (dynamicPartitionOverwrite) {
+ val fs = stagingDir.getFileSystem(taskContext.getConfiguration)
+ dynamicStagingTaskFiles.foreach { stagingTaskFile =>
+ val fileName = stagingTaskFile.getName
+ val partitionPath = getDynamicPartitionPath(stagingTaskFile,
taskContext)
+ val finalFile = new Path(partitionPath, fileName)
+ if (!fs.exists(finalFile) && !fs.rename(stagingTaskFile, finalFile)) {
Review comment:
Thanks, I just check the code.
It seems that the `SparkHadoopMapRedUtil.commitTask` has no meaning for
dynamic partition overwrite, because it has a specific staging dir
(`.spark-staging-jobId`) instead of use the working temporary of
FileOutputCommitter(`_temporary/0`).
So, the conflict issue is not related with the enable of
outputCommitCoordination.
> Another question is if it's possible the existing finalFile is corrupted
due to another task crashing during commit.
It is possible, because there may be several dynamicStagingTaskFiles,if the
task aborted when commitTask, partial outputs are moved to the partition paths.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]