@@ -66,6 +66,8 @@ class BlockManagerMasterEndpoint(
66
66
mapper
67
67
}
68
68
69
+ val proactivelyReplicate = conf.get(" spark.storage.replication.proactive" , " false" ).toBoolean
70
+
69
71
logInfo(" BlockManagerMasterEndpoint up" )
70
72
71
73
override def receiveAndReply (context : RpcCallContext ): PartialFunction [Any , Unit ] = {
@@ -189,13 +191,14 @@ class BlockManagerMasterEndpoint(
189
191
}
190
192
191
193
private def removeBlockManager (blockManagerId : BlockManagerId ) {
192
- val proactivelyReplicate = conf.get(" spark.storage.replication.proactive" , " false" ).toBoolean
193
-
194
194
val info = blockManagerInfo(blockManagerId)
195
195
196
196
// Remove the block manager from blockManagerIdByExecutor.
197
197
blockManagerIdByExecutor -= blockManagerId.executorId
198
198
199
+ // Remove it from blockManagerInfo and remove all the blocks.
200
+ blockManagerInfo.remove(blockManagerId)
201
+
199
202
val iterator = info.blocks.keySet.iterator
200
203
while (iterator.hasNext) {
201
204
val blockId = iterator.next
@@ -204,8 +207,10 @@ class BlockManagerMasterEndpoint(
204
207
if (locations.size == 0 ) {
205
208
blockLocations.remove(blockId)
206
209
logWarning(s " No more replicas available for $blockId ! " )
207
- } else if ((blockId.isRDD || blockId.isInstanceOf [TestBlockId ]) && proactivelyReplicate) {
208
- // we only need to proactively replicate RDD blocks
210
+ } else if (proactivelyReplicate && (blockId.isRDD || blockId.isInstanceOf [TestBlockId ])) {
211
+ // only RDD blocks store data that users explicitly cache so we only need to proactively
212
+ // replicate RDD blocks
213
+ // broadcast related blocks exist on all executors, so we don't worry about them
209
214
// we also need to replicate this behavior for test blocks for unit tests
210
215
// we send a message to a randomly chosen executor location to replicate block
211
216
// assuming single executor failure, we find out how many replicas existed before failure
@@ -222,8 +227,6 @@ class BlockManagerMasterEndpoint(
222
227
}
223
228
}
224
229
}
225
- // Remove it from blockManagerInfo and remove all the blocks.
226
- blockManagerInfo.remove(blockManagerId)
227
230
228
231
listenerBus.post(SparkListenerBlockManagerRemoved (System .currentTimeMillis(), blockManagerId))
229
232
logInfo(s " Removing block manager $blockManagerId" )
0 commit comments