Abhishek01911 commented on code in PR #17088:
URL: https://github.com/apache/pinot/pull/17088#discussion_r2471360784


##########
pinot-spi/src/main/java/org/apache/pinot/spi/stream/StreamMetadataProvider.java:
##########
@@ -86,7 +87,24 @@ StreamPartitionMsgOffset 
fetchStreamPartitionOffset(OffsetCriteria offsetCriteri
   default List<PartitionGroupMetadata> computePartitionGroupMetadata(String 
clientId, StreamConfig streamConfig,
       List<PartitionGroupConsumptionStatus> partitionGroupConsumptionStatuses, 
int timeoutMillis)
       throws IOException, TimeoutException {
-    int partitionCount = fetchPartitionCount(timeoutMillis);
+
+    int partitionCount;
+    try {
+      partitionCount = fetchPartitionCount(timeoutMillis);
+    } catch (Exception e) {
+      LOGGER.warn("Failed to fetch partition count for stream config: {}. 
Skipping stream and using"
+      + "existing partitions only. Error: {}", streamConfig.getTopicName(), 
e.getMessage(), e);
+      // Return only the existing partition groups if we can't fetch partition 
count
+      List<PartitionGroupMetadata> existingPartitionGroupMetadataList =
+      new ArrayList<>(partitionGroupConsumptionStatuses.size());
+      for (PartitionGroupConsumptionStatus 
currentPartitionGroupConsumptionStatus : partitionGroupConsumptionStatuses) {
+        existingPartitionGroupMetadataList.add(
+            new 
PartitionGroupMetadata(currentPartitionGroupConsumptionStatus.getStreamPartitionGroupId(),
+                currentPartitionGroupConsumptionStatus.getEndOffset()));

Review Comment:
   added a comment for it. endOffset is only set as start offset if the last 
consuming segment commited. 
   It will be equal to previous commit segment end offset



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