cecemei commented on code in PR #17943:
URL: https://github.com/apache/druid/pull/17943#discussion_r2060871695


##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/dart/worker/DartDataSegmentProvider.java:
##########
@@ -95,7 +96,10 @@ public Supplier<ResourceHolder<CompleteSegment>> 
fetchSegment(
         final PhysicalSegmentInspector inspector = 
segment.as(PhysicalSegmentInspector.class);
         channelCounters.addFile(inspector != null ? inspector.getNumRows() : 
0, 0);
       });
-      return new ReferenceCountingResourceHolder<>(new CompleteSegment(null, 
segment), closer);
+      return new ReferenceCountingResourceHolder<>(new CompleteSegment(
+          null,
+          Objects.requireNonNull(segment.getBaseSegment())
+      ), closer);

Review Comment:
   Re the stale reference, I think it might make more sense if we add 
`isClosed` to `Segment` interface. I feel the `Segment` is defined too broadly, 
and we should narrow the usage into:
   - `BaseSegment`, the real segment, close this usually means unlink the mmap.
   - `ReferenceCountingSegment`, this should only live in data nodes, places we 
actually care about the # of registered parties. It expose 
`acquireSegmentReference`, which registers a reference and returns a 
`CloseableSegmentReference`, close this means the base segment would be 
unlinked after all parties deregister, also `acquireSegmentReference` would 
return empty.
   - `ClosableSegmentReference`, this should replace the current 
`SegmentReference`, close this means deregister itself, but should have no 
direct impact to the base segment. `segmentMapFn` should operate on this. 
   



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