jolshan commented on code in PR #23630:
URL: https://github.com/apache/kafka/pull/23630#discussion_r4149583427
##########
core/src/test/scala/unit/kafka/coordinator/transaction/TransactionStateManagerTest.scala:
##########
@@ -480,6 +518,23 @@ class TransactionStateManagerTest {
transactionManager.appendTransactionToLog(transactionalId1,
coordinatorEpoch = 10, failedMetadata, assertCallback, requestLocal =
RequestLocal.withThreadConfinedCaching)
}
+ @Test
+ def testAppendSucceededButLeadershipLostBeforeCallback(): Unit = {
+ transactionManager.addLoadedTransactionsToCache(partitionId,
coordinatorEpoch, new ConcurrentHashMap[String, TransactionMetadata]())
+ transactionManager.putTransactionStateIfNotExists(txnMetadata1)
+
+ // the write succeeds but the replica becomes a follower before the
callback runs
Review Comment:
Had to think about this a second to make sure there wasn't any potential
issue, but makes sense. I guess it can also force the metadata refresh sooner.
--
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]