Github user nongli commented on a diff in the pull request:
https://github.com/apache/spark/pull/11436#discussion_r54505311
--- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala
---
@@ -648,6 +647,32 @@ private[spark] class BlockManager(
}
/**
+ * Retrieve the given block if it exists, otherwise call the provided
`makeIterator` method
+ * to compute the block, persist it, and return its values.
+ */
+ def getOrElseUpdate(
+ blockId: BlockId,
+ level: StorageLevel,
+ makeIterator: () => Iterator[Any]): BlockResult = {
+ // Initially we hold no locks on this block.
+ doPut(blockId, IteratorValues(makeIterator), level,
downgradeToReadLock = true)
--- End diff --
does anyone currently check the return value of doPut()? What if just
returned Option[BlockResult] and then you can skip some of the logic below.
---
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]