cbalci commented on code in PR #17669:
URL: https://github.com/apache/pinot/pull/17669#discussion_r2801915247


##########
pinot-spi/src/main/java/org/apache/pinot/spi/stream/PartitionGroupMetadataFetcher.java:
##########
@@ -122,6 +122,20 @@ private Boolean fetchMultipleStreams()
               .collect(Collectors.toList());
       try (StreamMetadataProvider streamMetadataProvider = 
streamConsumerFactory.createStreamMetadataProvider(
           StreamConsumerFactory.getUniqueClientId(clientId))) {
+
+        // Check if the topic exists before fetching partition metadata
+        try {
+          List<StreamMetadataProvider.TopicMetadata> topics = 
streamMetadataProvider.getTopics();

Review Comment:
   We can collect this list once, outside the loop.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/stream/PartitionGroupMetadataFetcher.java:
##########
@@ -122,6 +122,20 @@ private Boolean fetchMultipleStreams()
               .collect(Collectors.toList());
       try (StreamMetadataProvider streamMetadataProvider = 
streamConsumerFactory.createStreamMetadataProvider(
           StreamConsumerFactory.getUniqueClientId(clientId))) {
+
+        // Check if the topic exists before fetching partition metadata
+        try {
+          List<StreamMetadataProvider.TopicMetadata> topics = 
streamMetadataProvider.getTopics();
+          boolean topicExists = topics.stream().anyMatch(t -> 
t.getName().equals(topicName));
+          if (!topicExists) {
+            LOGGER.warn("Topic {} does not exist. Skipping this topic from 
ingestion.", topicName);
+            continue;
+          }
+        } catch (Exception e) {

Review Comment:
   Can we add a more granular error check here? 
   We can add 'debug' log on `UnsupportedOperationException` cases and a 'warn' 
with exception details on others.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to