Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/10705#discussion_r54182055
--- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala
---
@@ -452,7 +440,10 @@ private[spark] class BlockManager(
if (level.useMemory) {
logDebug(s"Getting block $blockId from memory")
val result = if (asBlockResult) {
- memoryStore.getValues(blockId).map(new BlockResult(_,
DataReadMethod.Memory, info.size))
+ memoryStore.getValues(blockId).map { iter =>
+ val ci = CompletionIterator[Any, Iterator[Any]](iter,
releaseLock(blockId))
+ new BlockResult(ci, DataReadMethod.Memory, info.size)
--- End diff --
The difference is that now the programmer needs to explicitly
`completionCallback = None`. If the `completionCallback` is specified then you
don't need to do the network check. It's better in that today you have zero
reminder that you need to release the lock by the end of the task.
Actually an even better way IMO is to have a `LocalBlockResult` and a
`RemoteBlockResult` so there's no way the programmer can forget to release the
lock.
By the way, I'm not quite done reviewing yet but feel free to address these
in a follow-up patch.
---
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]