abhishekagarwal87 commented on a change in pull request #11398:
URL: https://github.com/apache/druid/pull/11398#discussion_r668640964



##########
File path: 
server/src/main/java/org/apache/druid/segment/loading/SegmentLoaderLocalCacheManager.java
##########
@@ -203,8 +219,8 @@ public Segment getSegment(DataSegment segment, boolean 
lazy, SegmentLazyLoadFail
     } else {
       factory = new MMappedQueryableSegmentizerFactory(indexIO);
     }
-
-    return factory.factorize(segment, segmentFiles, lazy, loadFailed);
+    Segment baseSegment = factory.factorize(segment, segmentFiles, lazy, 
loadFailed);
+    return ReferenceCountingSegment.wrapSegment(baseSegment, 
segment.getShardSpec());

Review comment:
       IMO It should return a different `ReferenceCountingSegment` here since 
the base object too is being re-created. That being said, other implementations 
can return the same object if they can. 
   
   Ideally, I wanted to return a `SegmentReference` here but 
`ReferenceCountingObject` is heavily used already. 




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