You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/05/16 09:29:05 UTC

[GitHub] [kafka] dengziming commented on a diff in pull request #12165: KAFKA-13905: Fix failing ServerShutdownTest.testCleanShutdownAfterFailedStartupDueToCorruptLogs

dengziming commented on code in PR #12165:
URL: https://github.com/apache/kafka/pull/12165#discussion_r873512570


##########
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:
   Yeah, in the finally block, we will unwrap `ExecutionExecution` so we don't have to invoke `getCause`, but after #11969 the exception type is `RuntimeException` so we have to invoke getCause once more:
   https://github.com/apache/kafka/blob/49226721c0dc5e5b327e0754e01c367990b43758/core/src/main/scala/kafka/server/BrokerServer.scala#L444
   
   I find this is code is no longer useful after #11969, do you think we can remove it here?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org