kirktrue commented on code in PR #15737:
URL: https://github.com/apache/kafka/pull/15737#discussion_r1579722758


##########
tests/kafkatest/services/verifiable_consumer.py:
##########
@@ -140,22 +150,31 @@ class 
IncrementalAssignmentConsumerEventHandler(ConsumerEventHandler):
     def __init__(self, node, verify_offsets, idx):
         super().__init__(node, verify_offsets, idx)
         
-    def handle_partitions_revoked(self, event):
+    def handle_partitions_revoked(self, event, node, logger):
         self.revoked_count += 1
         self.state = ConsumerState.Rebalancing
         self.position = {}
+        revoked = []
+
         for topic_partition in event["partitions"]:
-            topic = topic_partition["topic"]
-            partition = topic_partition["partition"]
-            self.assignment.remove(TopicPartition(topic, partition))
+            tp = _create_partition_from_dict(topic_partition)
+            assert tp in self.assignment, \
+                "Topic partition %s cannot be revoked from %s as it was not 
previously assigned to that consumer" % \
+                (tp, node.account.hostname)

Review Comment:
   @lucasbru—this is the main functional change: ensure that an attempt to 
remove a partition from the local state verifies that it was previously 
assigned.



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

Reply via email to