Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18076#discussion_r118137650
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/BlockManager.scala 
---
    @@ -501,14 +501,18 @@ private[spark] class BlockManager(
           case Some(info) =>
             val level = info.level
             logDebug(s"Level for block $blockId is $level")
    +        val taskAttemptId = 
Option(TaskContext.get()).map(_.taskAttemptId())
    +          .getOrElse(BlockInfo.NON_TASK_WRITER)
             if (level.useMemory && memoryStore.contains(blockId)) {
               val iter: Iterator[Any] = if (level.deserialized) {
                 memoryStore.getValues(blockId).get
               } else {
                 serializerManager.dataDeserializeStream(
                   blockId, 
memoryStore.getBytes(blockId).get.toInputStream())(info.classTag)
               }
    -          val ci = CompletionIterator[Any, Iterator[Any]](iter, 
releaseLock(blockId))
    --- End diff --
    
    I'd add a one-line comment before this line which references SPARK-18406, 
something like
    
    > "We need to capture the current taskId in case the iterator completion is 
triggered from a different thread which does not have TaskContext set; see 
SPARK-18406 for discussion"
    
    or similar.


---
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]

Reply via email to