diff --git a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala index 2f9473aedc2dc..00fa94fc9fbf4 100644 --- a/core/src/main/scala/org/apache/spark/storage/BlockManager.scala +++ b/core/src/main/scala/org/apache/spark/storage/BlockManager.scala @@ -442,6 +442,8 @@ private[spark] class BlockManager( Some(new BlockResult(ci, DataReadMethod.Disk, info.size)) } else { releaseLock(blockId) + // Remove the missing block so that its unavailability is reported to the driver + removeBlock(blockId) throw new SparkException(s"Block $blockId was not found even though it's read-locked") } } @@ -490,6 +492,8 @@ private[spark] class BlockManager( serializerManager.dataSerialize(blockId, memoryStore.getValues(blockId).get) } else { releaseLock(blockId) + // Remove the missing block so that its unavailability is reported to the driver + removeBlock(blockId) throw new SparkException(s"Block $blockId was not found even though it's read-locked") } } else { // storage level is serialized @@ -500,6 +504,8 @@ private[spark] class BlockManager( maybeCacheDiskBytesInMemory(info, blockId, level, diskBytes).getOrElse(diskBytes) } else { releaseLock(blockId) + // Remove the missing block so that its unavailability is reported to the driver + removeBlock(blockId) throw new SparkException(s"Block $blockId was not found even though it's read-locked") } }