jackjlli commented on code in PR #9424:
URL: https://github.com/apache/pinot/pull/9424#discussion_r980510492


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/LLRealtimeSegmentDataManager.java:
##########
@@ -1435,10 +1428,13 @@ private void setConsumeEndTime(SegmentZKMetadata 
segmentZKMetadata, long now) {
   }
 
   public StreamPartitionMsgOffset fetchLatestStreamOffset(long maxWaitTimeMs) {
-    try (StreamMetadataProvider metadataProvider = 
_streamConsumerFactory.createPartitionMetadataProvider(_clientId,
-        _partitionGroupId)) {
-      return 
metadataProvider.fetchStreamPartitionOffset(OffsetCriteria.LARGEST_OFFSET_CRITERIA,
 maxWaitTimeMs);
-    } catch (Exception e) {
+    if (_partitionMetadataProvider == null) {
+      createPartitionMetadataProvider("Fetch latest stream offset");
+    }
+    try {
+      return 
_partitionMetadataProvider.fetchStreamPartitionOffset(OffsetCriteria.LARGEST_OFFSET_CRITERIA,

Review Comment:
   +1 on this. No need to instantiate another partitionLevelMetadataProvider 
here.



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