CalvinConfluent commented on code in PR #14612:
URL: https://github.com/apache/kafka/pull/14612#discussion_r1451037879


##########
core/src/main/java/kafka/server/handlers/DescribeTopicPartitionsRequestHandler.java:
##########
@@ -103,14 +102,20 @@ public DescribeTopicPartitionsResponseData 
handleDescribeTopicPartitionsRequest(
                 );
             }
             return isAuthorized;
-        }).sorted().iterator();
+        }).sorted();
+
+        // Reset the first partition index if the cursor topic is missing from 
the authorized topic list.
+        int firstPartitionId = !cursorTopicName.isEmpty() && 
authHelper.authorize(
+            abstractRequest.context(), DESCRIBE, TOPIC, cursorTopicName, true, 
true, 1)
+            ? cursor.partitionIndex() : 0;

Review Comment:
   Good point. Previously I did not find an easy way to get the first element 
of a stream/iterator, so I verify the cursor topic again. Now I passed a 
functor to return the start index for each topic which only return non zero 
value for cursor topic.



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