showuon commented on code in PR #12165:
URL: https://github.com/apache/kafka/pull/12165#discussion_r873525802
##########
core/src/test/scala/unit/kafka/server/ServerShutdownTest.scala:
##########
@@ -195,8 +195,9 @@ class ServerShutdownTest extends KafkaServerTestHarness {
// identify the correct exception, making sure the server was shutdown,
and cleaning up if anything
// goes wrong so that awaitShutdown doesn't hang
case e: Exception =>
- assertTrue(exceptionClassTag.runtimeClass.isInstance(e), s"Unexpected
exception $e")
- assertEquals(if (quorum == "zk") BrokerState.NOT_RUNNING else
BrokerState.SHUTTING_DOWN, brokers.head.brokerState)
+ assertTrue(exceptionClassTag.runtimeClass.isInstance(if (isKRaftTest()
&& e.isInstanceOf[RuntimeException]) e.getCause.getCause else e),
Review Comment:
Thanks for the explanation. I understand now. So, do you think we should fix
the failed tests by fixing this:
https://github.com/apache/kafka/blob/49226721c0dc5e5b327e0754e01c367990b43758/core/src/main/scala/kafka/server/BrokerServer.scala#L444
I mean, the above code is trying to throw the root cause reason the broker
failed up to here:
https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/Kafka.scala#L113
And then, we can log the root cause before exit. So, I think we should fix
the line `throw if (e.isInstanceOf[ExecutionException]) e.getCause else e ` to
allow it to throw the root cause for both `ExecutionException` and
`RuntimeException`. WDYT?
--
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]