Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/9373#discussion_r44608862
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/util/FileBasedWriteAheadLog.scala
---
@@ -251,4 +261,23 @@ private[streaming] object FileBasedWriteAheadLog {
}
}.sortBy { _.startTime }
}
+
+ /**
+ * This creates an iterator from a parallel collection, by keeping at
most `n` objects in memory
+ * at any given time, where `n` is the size of the thread pool. This is
crucial for use cases
+ * where we create `FileBasedWriteAheadLogReader`s during parallel
recovery. We don't want to
+ * open up `k` streams altogether where `k` is the size of the Seq that
we want to parallelize.
+ */
+ def seqToParIterator[I, O](
+ tpool: ThreadPoolExecutor,
+ source: Seq[I],
+ handler: I => Iterator[O]): Iterator[O] = {
+ val taskSupport = new ThreadPoolTaskSupport(tpool)
+ val groupSize = math.max(math.max(tpool.getCorePoolSize,
tpool.getPoolSize), 8)
--- End diff --
Its not safe for the rest of the system to allow infinite number of thread.
I think there should be limits. The limit can be a sparkconf that will not be
exposed publicly.
---
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]