Github user cloud-fan commented on the pull request:
https://github.com/apache/spark/pull/791#issuecomment-43738827
@mridulm I checked the code of BlockManager#doPut.
val putBlockInfo = {
val tinfo = new BlockInfo(level, tellMaster)
// Do atomically !
val oldBlockOpt = blockInfo.putIfAbsent(blockId, tinfo)
if (oldBlockOpt.isDefined) {
if (oldBlockOpt.get.waitForReady()) {
logWarning("Block " + blockId + " already exists on this machine;
not re-adding it")
return updatedBlocks
}
// TODO: So the block info exists - but previous attempt to load it
(?) failed.
// What do we do now ? Retry on it ?
oldBlockOpt.get
} else {
tinfo
}
}
BlockManger will create a BlockInfo for the block to be added, and `val
oldBlockOpt = blockInfo.putIfAbsent(blockId, tinfo)`, so if multi threads are
adding same block, one thread will put the BlockInfo successfully and the
other will fail and stop to put.
---
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.
---