m1a2st commented on code in PR #17563:
URL: https://github.com/apache/kafka/pull/17563#discussion_r1809214823


##########
core/src/main/scala/kafka/server/ReplicaManager.scala:
##########
@@ -469,14 +469,18 @@ class ReplicaManager(val config: KafkaConfig,
     })
   }
 
-  private def completeDelayedOperationsWhenNotPartitionLeader(topicPartition: 
TopicPartition, topicId: Option[Uuid]): Unit = {
+  private def completeDelayedOperationsWhenNotPartitionLeader(topicPartition: 
TopicPartition, topicId: Option[Uuid],
+                                                              isStopReplica: 
Boolean): Unit = {
     val topicPartitionOperationKey = TopicPartitionOperationKey(topicPartition)
     delayedProducePurgatory.checkAndComplete(topicPartitionOperationKey)
-    delayedFetchPurgatory.checkAndComplete(topicPartitionOperationKey)
-    delayedRemoteFetchPurgatory.checkAndComplete(topicPartitionOperationKey)
-    
delayedRemoteListOffsetsPurgatory.checkAndComplete(topicPartitionOperationKey)
-    if (topicId.isDefined) delayedShareFetchPurgatory.checkAndComplete(
-      new DelayedShareFetchPartitionKey(topicId.get, 
topicPartition.partition()))
+    // We support fetch from follower now, So only 'stop reply' requires the 
following things
+    if (isStopReplica) {
+      delayedFetchPurgatory.checkAndComplete(topicPartitionOperationKey)

Review Comment:
   Pardon me, I have a question. Some tests case are checking that the produce 
failed because it changed to follower before replicating, if we won't 
completion this fetch purgatory, and we can't observe the error about 
`NOT_LEADER_OR_FOLLOWER`.  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]

Reply via email to