Skip to content

Commit 3e29e37

Browse files
author
Andrew Or
committed
[SPARK-14468] Always enable OutputCommitCoordinator
## What changes were proposed in this pull request? `OutputCommitCoordinator` was introduced to deal with concurrent task attempts racing to write output, leading to data loss or corruption. For more detail, read the [JIRA description](https://issues.apache.org/jira/browse/SPARK-14468). Before: `OutputCommitCoordinator` is enabled only if speculation is enabled. After: `OutputCommitCoordinator` is always enabled. Users may still disable this through `spark.hadoop.outputCommitCoordination.enabled`, but they really shouldn't... ## How was this patch tested? `OutputCommitCoordinator*Suite` Author: Andrew Or <[email protected]> Closes #12244 from andrewor14/always-occ.
1 parent 30e980a commit 3e29e37

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

core/src/main/scala/org/apache/spark/mapred/SparkHadoopMapRedUtil.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ object SparkHadoopMapRedUtil extends Logging {
3333
* the driver in order to determine whether this attempt can commit (please see SPARK-4879 for
3434
* details).
3535
*
36-
* Output commit coordinator is only contacted when the following two configurations are both set
37-
* to `true`:
38-
*
39-
* - `spark.speculation`
40-
* - `spark.hadoop.outputCommitCoordination.enabled`
36+
* Output commit coordinator is only used when `spark.hadoop.outputCommitCoordination.enabled`
37+
* is set to true (which is the default).
4138
*/
4239
def commitTask(
4340
committer: MapReduceOutputCommitter,
@@ -64,11 +61,10 @@ object SparkHadoopMapRedUtil extends Logging {
6461
if (committer.needsTaskCommit(mrTaskContext)) {
6562
val shouldCoordinateWithDriver: Boolean = {
6663
val sparkConf = SparkEnv.get.conf
67-
// We only need to coordinate with the driver if there are multiple concurrent task
68-
// attempts, which should only occur if speculation is enabled
69-
val speculationEnabled = sparkConf.getBoolean("spark.speculation", defaultValue = false)
70-
// This (undocumented) setting is an escape-hatch in case the commit code introduces bugs
71-
sparkConf.getBoolean("spark.hadoop.outputCommitCoordination.enabled", speculationEnabled)
64+
// We only need to coordinate with the driver if there are concurrent task attempts.
65+
// Note that this could happen even when speculation is not enabled (e.g. see SPARK-8029).
66+
// This (undocumented) setting is an escape-hatch in case the commit code introduces bugs.
67+
sparkConf.getBoolean("spark.hadoop.outputCommitCoordination.enabled", defaultValue = true)
7268
}
7369

7470
if (shouldCoordinateWithDriver) {

core/src/test/scala/org/apache/spark/scheduler/OutputCommitCoordinatorIntegrationSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class OutputCommitCoordinatorIntegrationSuite
3838
super.beforeAll()
3939
val conf = new SparkConf()
4040
.set("master", "local[2,4]")
41-
.set("spark.speculation", "true")
41+
.set("spark.hadoop.outputCommitCoordination.enabled", "true")
4242
.set("spark.hadoop.mapred.output.committer.class",
4343
classOf[ThrowExceptionOnFirstAttemptOutputCommitter].getCanonicalName)
4444
sc = new SparkContext("local[2, 4]", "test", conf)

core/src/test/scala/org/apache/spark/scheduler/OutputCommitCoordinatorSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class OutputCommitCoordinatorSuite extends SparkFunSuite with BeforeAndAfter {
7777
val conf = new SparkConf()
7878
.setMaster("local[4]")
7979
.setAppName(classOf[OutputCommitCoordinatorSuite].getSimpleName)
80-
.set("spark.speculation", "true")
80+
.set("spark.hadoop.outputCommitCoordination.enabled", "true")
8181
sc = new SparkContext(conf) {
8282
override private[spark] def createSparkEnv(
8383
conf: SparkConf,

0 commit comments

Comments
 (0)