JimmyWang6 commented on code in PR #19820: URL: https://github.com/apache/kafka/pull/19820#discussion_r2164713759
########## core/src/main/scala/kafka/server/KafkaApis.scala: ########## @@ -3772,7 +3772,19 @@ class KafkaApis(val requestChannel: RequestChannel, case Some(error) => topic.partitions().forEach(partition => responseBuilder.addPartition(topic.topicName(), partition.partitionIndex(), metadataCache.topicNamesToIds(), error.error)) case None => - authorizedTopicPartitions.add(topic) Review Comment: Hi @chia7712 , Much thanks for your review. This is a bug related to my previous PR :( The add method always returns false and fails to add the topic correctly because the condition `newElement.prev() != INVALID_INDEX || newElement.next() != INVALID_INDEX `evaluates to true. I believe this occurs because the topic has already been added to an `ImplicitLinkedHashCollection`, meaning the prev() and next() pointers of the specified topic are no longer invalid. Therefore, I'm attempting to create a new topic here. public final boolean add(E newElement) { if (newElement == null) { return false; } if (newElement.prev() != INVALID_INDEX || newElement.next() != INVALID_INDEX) { return false; } if ((size + 1) >= elements.length / 2) { changeCapacity(calculateCapacity(elements.length)); } int slot = addInternal(newElement, elements); if (slot >= 0) { addToListTail(head, elements, slot); size++; return true; } return false; } -- 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