Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/4066#discussion_r23990802
--- Diff: core/src/main/scala/org/apache/spark/SparkHadoopWriter.scala ---
@@ -105,24 +106,61 @@ class SparkHadoopWriter(@transient jobConf: JobConf)
def commit() {
val taCtxt = getTaskContext()
val cmtr = getOutputCommitter()
- if (cmtr.needsTaskCommit(taCtxt)) {
+
+ // Called after we have decided to commit
+ def performCommit(): Unit = {
try {
cmtr.commitTask(taCtxt)
- logInfo (taID + ": Committed")
+ logInfo (s"$taID: Committed")
} catch {
- case e: IOException => {
+ case e: IOException =>
logError("Error committing the output of task: " + taID.value, e)
cmtr.abortTask(taCtxt)
throw e
+ }
+ }
+
+ // First, check whether the task's output has already been committed
by some other attempt
+ if (cmtr.needsTaskCommit(taCtxt)) {
+ // The task output needs to be committed, but we don't know whether
some other task attempt
+ // might be racing to commit the same output partition. Therefore,
coordinate with the driver
+ // in order to determine whether this attempt can commit.
+ val shouldCoordinateWithDriver: Boolean = {
+ val sparkConf = SparkEnv.get.conf
+ // We only need to coordinate with the driver if there are
multiple concurrent task
+ // attempts, which should only occur if speculation is enabled
+ val speculationEnabled = sparkConf.getBoolean("spark.speculation",
false)
+ // This (undocumented) setting is an escape-hatch in case the
commit code introduces bugs
+ //
sparkConf.getBoolean("spark.hadoop.outputCommitCoordination.enabled",
speculationEnabled)
+
+ // TODO: revert this before merging the PR; this is enabled so
this code path is exercised
+ // by more tests (even though it might not be _necessary_, it
should be _safe_ to do the
+ // extra coordination)
+ true
--- End diff --
I added this line in just so that Jenkins would run the CheckpointSuite
test that had previously failed. It would be good to try to extract a unit
test out of that.
---
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]