hachikuji commented on a change in pull request #10909: URL: https://github.com/apache/kafka/pull/10909#discussion_r680128631
########## File path: core/src/main/scala/kafka/tools/TestRaftServer.scala ########## @@ -193,10 +193,13 @@ class TestRaftServer( currentTimeMs: Long ): Unit = { recordCount.incrementAndGet() - - raftManager.scheduleAppend(leaderEpoch, Seq(payload)) match { - case Some(offset) => pendingAppends.offer(PendingAppend(offset, currentTimeMs)) - case None => time.sleep(10) + try { + val offset = raftManager.client.scheduleAppend(leaderEpoch, List(payload).asJava) + pendingAppends.offer(PendingAppend(offset, currentTimeMs)) + } catch { + case e: Exception => + logger.warn("Appending failed, transition to resigned", e) Review comment: How about this instead? ```scala case e: FencedEpochException => logger.debug(s"Append failed because this node is no longer leader in epoch $leaderEpoch", e) time.sleep(10) ``` For every other exception type, we can let it propagate. -- 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-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org