[ https://issues.apache.org/jira/browse/KAFKA-10312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165435#comment-17165435 ]
Raman Verma commented on KAFKA-10312: ------------------------------------- I have a patch available. Need permission to be able to assign the ticket to myself. > MetadataCache.getPartitionMetadata may return incorrect error code when > partition's leader is not present at the MetadataCache > ------------------------------------------------------------------------------------------------------------------------------ > > Key: KAFKA-10312 > URL: https://issues.apache.org/jira/browse/KAFKA-10312 > Project: Kafka > Issue Type: Bug > Components: core > Reporter: Raman Verma > Priority: Minor > > `MetadataCache.getPartitionMetadata` returns an error code if the partition's > leader is not present at the MetadataCache, or if the Listener endpoint is > not present for the leader. Newer versions for metadata returns > LEADER_NOT_AVAILABLE and LISTENER_NOT_FOUND for the above two cases > respectively. > There is a small bug in this logic. Current code checks the MetadataCache's > host broker Id instead of the partition's leader id (in the list of alive > brokers) when determining what error code to return. This may result in this > call returning LISTENER_NOT_FOUND error code even when partition's leader is > not present at MetadataCache and it should have returned LEADER_NOT_AVAILABLE. -- This message was sent by Atlassian Jira (v8.3.4#803005)