Copilot commented on code in PR #16741:
URL: https://github.com/apache/pinot/pull/16741#discussion_r2324060672
##########
pinot-server/src/main/java/org/apache/pinot/server/api/resources/TablesResource.java:
##########
@@ -1085,6 +1086,10 @@ public List<SegmentConsumerInfo>
getConsumingSegmentsInfo(
recordsLagMap, availabilityLagMsMap)));
}
}
+ } catch (ConcurrentModificationException e) {
+ LOGGER.warn("Multi-threaded access is unsafe for KafkaConsumer, caught
exception while fetching stream offset",
+ e);
Review Comment:
[nitpick] The catch block for `ConcurrentModificationException` returns a
potentially incomplete `segmentConsumerInfoList`. Consider logging which
segments were successfully processed and which failed, or adding a flag to
indicate partial results to help with debugging and monitoring.
```suggestion
List<String> processedSegments = segmentConsumerInfoList.stream()
.map(SegmentConsumerInfo::getSegmentName)
.collect(Collectors.toList());
List<String> allSegments = segmentDataManagers.stream()
.map(SegmentDataManager::getSegmentName)
.collect(Collectors.toList());
List<String> unprocessedSegments = new ArrayList<>(allSegments);
unprocessedSegments.removeAll(processedSegments);
LOGGER.warn("Multi-threaded access is unsafe for KafkaConsumer, caught
exception while fetching stream offset. "
+ "Processed segments: {}. Unprocessed segments: {}.",
processedSegments, unprocessedSegments, e);
```
--
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]