You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2016/04/18 14:58:21 UTC
[GitHub] spark pull request: [SPARK-13407] Guard against garbage-collected ...
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org