Github user aarondav commented on a diff in the pull request:
https://github.com/apache/spark/pull/5139#discussion_r27357060
--- Diff:
core/src/main/scala/org/apache/spark/mapred/SparkHadoopMapRedUtil.scala ---
@@ -65,3 +71,77 @@ trait SparkHadoopMapRedUtil {
}
}
}
+
+object SparkHadoopMapRedUtil extends Logging {
+ def commitTask(
+ committer: MapReduceOutputCommitter,
+ mrTaskContext: MapReduceTaskAttemptContext,
+ sparkTaskContext: TaskContext): Unit = {
+ commitTask(
+ committer,
+ mrTaskContext,
+ sparkTaskContext.stageId(),
+ sparkTaskContext.partitionId(),
+ sparkTaskContext.attemptNumber())
+ }
+
+ def commitTask(
+ committer: MapReduceOutputCommitter,
+ mrTaskContext: MapReduceTaskAttemptContext,
+ jobId: Int,
+ splitId: Int,
+ attemptId: Int): Unit = {
+
+ val mrTaskAttemptID = mrTaskContext.getTaskAttemptID
+
+ // Called after we have decided to commit
+ def performCommit(): Unit = {
+ try {
+ committer.commitTask(mrTaskContext)
+ logInfo(s"$mrTaskAttemptID: Committed")
+ } catch {
+ case cause: IOException =>
+ logError(s"Error committing the output of task:
$mrTaskAttemptID", cause)
+ committer.abortTask(mrTaskContext)
+ throw cause
+ }
+ }
+
+ // First, check whether the task's output has already been committed
by some other attempt
+ if (committer.needsTaskCommit(mrTaskContext)) {
+ // The task output needs to be committed, but we don't know whether
some other task attempt
--- End diff --
In fact, it may be sufficient to lift and modify this comment up to the
javadoc.
---
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]