Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/11276#discussion_r60052448
--- Diff: core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala
---
@@ -364,6 +364,27 @@ class TaskMetrics private[spark] (initialAccums:
Seq[Accumulator[_]]) extends Se
}
+/**
+ * Internal subclass of [[TaskMetrics]] which is used only for posting
events to listeners.
+ * Its purpose is to obviate the need for the driver to reconstruct the
original accumulators,
+ * which might have been garbage-collected. See SPARK-13407 for more
details.
+ *
+ * Instances of this class should be considered read-only and users should
not call `inc*()` or
+ * `set*()` methods. While we could override the setter methods to throw
+ * UnsupportedOperationException, we choose not to do so because the
overrides would quickly become
+ * out-of-date when new metrics are added.
+ */
+private[spark] class ListenerTaskMetrics(
+ initialAccums: Seq[Accumulator[_]],
+ accumUpdates: Seq[AccumulableInfo]) extends TaskMetrics(initialAccums)
{
+
+ override def accumulatorUpdates(): Seq[AccumulableInfo] = accumUpdates
--- End diff --
Does this PR avoid accessing the original accumulators on the driver only
for `accumulatorUpdates`? Other methods like `resultSize` still reference to
original accumulators right?
---
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]