mridulm commented on a change in pull request #34043:
URL: https://github.com/apache/spark/pull/34043#discussion_r714464726



##########
File path: 
core/src/main/scala/org/apache/spark/storage/BlockManagerMasterEndpoint.scala
##########
@@ -117,12 +117,15 @@ class BlockManagerMasterEndpoint(
 
     case _updateBlockInfo @
         UpdateBlockInfo(blockManagerId, blockId, storageLevel, 
deserializedSize, size) =>
-      val isSuccess = updateBlockInfo(blockManagerId, blockId, storageLevel, 
deserializedSize, size)
-      context.reply(isSuccess)
-      // SPARK-30594: we should not post `SparkListenerBlockUpdated` when 
updateBlockInfo
-      // returns false since the block info would be updated again later.
-      if (isSuccess) {
-        
listenerBus.post(SparkListenerBlockUpdated(BlockUpdatedInfo(_updateBlockInfo)))
+      val response = updateBlockInfo(blockManagerId, blockId, storageLevel, 
deserializedSize, size)
+
+      response.foreach { isSuccess =>
+        // SPARK-30594: we should not post `SparkListenerBlockUpdated` when 
updateBlockInfo
+        // returns false since the block info would be updated again later.
+        if (isSuccess) {
+          
listenerBus.post(SparkListenerBlockUpdated(BlockUpdatedInfo(_updateBlockInfo)))
+        }
+        context.reply(isSuccess)

Review comment:
       Did not realize this - thanks for pointing it out !
   So if I understood it right, the proposal is:
   
   ```
     def handleResult(success: Boolean): Unit = {
       if (success) {
         // post
       }
       context.reply(success)
     }
   
     if (blockId.isShuffle) {
       updateShuffleBlockInfo( ... ).foreach( handleResult(_))
     } else {
       handleResult(updateBlockInfo( ... ))
     }
   ```
   ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to