GitHub user CodingCat opened a pull request:
https://github.com/apache/spark/pull/228
SPARK-732: eliminate duplicate update of the accumulator
https://spark-project.atlassian.net/browse/SPARK-732?filter=-1
In current implementation, the accumulator will be updated for every
successfully finished task, even the task is from a resubmitted stage, which
makes the accumulator counter-intuitive
In this patch, I changed the way for the DAGScheduler to update the
accumulator,
DAGScheduler maintains a HashTable, mapping the stage id to the received
<accumulator_id , value> pairs. Only when the stage becomes independent, (no
job needs it any more), we accumulate the values of the <accumulator_id ,
value> pairs, in this way, even the stage is resubmitted, we check if the
HashTable has contained such stageId, it refuses to record the pairs.
---
However, the existence of the duplicate update is also related to the
cache, especially when we make some accumulator operation in the
transformation....(the original JIRA also discussed this)
e.g.
```
val a = sc.parallelize(List(1, 2, 3, 4))
val b = a.map(i => {accum += 1; i + 1})
val c = b.filter(i => i < 4)
c.count() - accum is 4
c.count() - accum is 8
b.cache()
c.count() - accum is still 8
```
My question here is whether we should take care of the update in the
transformation, or we assume that the user should be aware of the possible
duplicate update
Glad to hear your advice
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/CodingCat/spark SPARK-732
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/228.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #228
----
----
---
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.
---