sumeetgajjar commented on a change in pull request #32043:
URL: https://github.com/apache/spark/pull/32043#discussion_r607240716
##########
File path: core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala
##########
@@ -416,6 +423,35 @@ class ExecutorSuite extends SparkFunSuite
assert(taskMetrics.getMetricValue("JVMHeapMemory") > 0)
}
+ test("SPARK-34949: do not re-register BlockManager when executor is shutting
down") {
+ val reregisterInvoked = new AtomicBoolean(false)
+ val mockBlockManager = mock[BlockManager]
+ when(mockBlockManager.reregister()).thenAnswer { (_: InvocationOnMock) =>
+ reregisterInvoked.getAndSet(true)
+ }
+ val conf = new SparkConf(false).setAppName("test").setMaster("local[2]")
+ val mockEnv = createMockEnv(conf, new JavaSerializer(conf))
+ when(mockEnv.blockManager).thenReturn(mockBlockManager)
+
+ withExecutor("id", "localhost", mockEnv) { executor =>
+ withMockHeartbeatReceiverRef(executor) { mockReceiverRef =>
+ when(mockReceiverRef.askSync(any[Heartbeat],
any[RpcTimeout])(any)).thenAnswer {
+ (_: InvocationOnMock) => HeartbeatResponse(reregisterBlockManager =
true)
+ }
+ val reportHeartbeat = PrivateMethod[Unit](Symbol("reportHeartBeat"))
+ executor.invokePrivate(reportHeartbeat())
+ assert(reregisterInvoked.get(),
+ "BlockManager.reregister not invoked when reregisterBlockManager was
true")
Review comment:
Hi @dongjoon-hyun ,
I am slightly confused here about the question.
if you are pointing to the assertion then yes, I am asserting that when the
executor shutdown is not initiated, `BlockManager.reregister` is invoked
successfully by `Executor.reportHeartbeat`.
However, if you pointing to the `assertion clue`, then I can see how that
can be ambiguous, I can change the message to
"BlockManager.reregister not invoked on Heartbeat response when executor is
not shutting down"
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]