Shekharrajak commented on code in PR #22357:
URL: https://github.com/apache/kafka/pull/22357#discussion_r3409737223


##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -3264,6 +3817,145 @@ class KafkaApisTest extends Logging {
       any())
   }
 
+  @Test
+  def testWriteTxnMarkersDoesNotApplyShareMarkerForNonShareStatePartition(): 
Unit = {
+    val topicPartition = new TopicPartition("t", 0)
+    val (_, request) = 
createWriteTxnMarkersRequest(util.List.of(topicPartition))
+    val responseCallback: ArgumentCaptor[util.Map[TopicIdPartition, 
PartitionResponse] => Unit] =
+      ArgumentCaptor.forClass(classOf[util.Map[TopicIdPartition, 
PartitionResponse] => Unit])
+
+    when(replicaManager.onlinePartition(topicPartition))
+      .thenReturn(Some(mock(classOf[Partition])))
+    when(replicaManager.topicIdPartition(topicPartition))
+      .thenReturn(new TopicIdPartition(Uuid.randomUuid, topicPartition))
+    when(replicaManager.appendRecords(
+      anyLong,
+      anyShort,
+      ArgumentMatchers.eq(true),
+      ArgumentMatchers.eq(AppendOrigin.COORDINATOR),
+      any(),
+      responseCallback.capture(),
+      any(),
+      any(),
+      any(),
+      any()
+    )).thenAnswer(_ => responseCallback.getValue.apply(util.Map.of(
+      new TopicIdPartition(Uuid.randomUuid, topicPartition),
+      new PartitionResponse(Errors.NONE)
+    )))
+
+    kafkaApis = createKafkaApis()
+    kafkaApis.handleWriteTxnMarkersRequest(request, 
RequestLocal.withThreadConfinedCaching)
+
+    verify(sharePartitionManager, never()).applyTxnMarker(anyLong, anyShort, 
any())
+    verifyNoThrottling[WriteTxnMarkersResponse](request)
+  }
+
+  @Test
+  def testWriteTxnMarkersRoutesShareStateMarkerToShareCoordinator(): Unit = {

Review Comment:
   transaction marker for __share_group_state goes to 
shareCoordinator.completeTransaction(...); coordinator finalizes durable state; 
source broker invalidates affected SharePartition caches.



-- 
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]

Reply via email to