surekhasaharan commented on a change in pull request #7425: Add is_overshadowed 
column to sys.segments table
URL: https://github.com/apache/incubator-druid/pull/7425#discussion_r277093924
 
 

 ##########
 File path: 
sql/src/main/java/org/apache/druid/sql/calcite/schema/MetadataSegmentView.java
 ##########
 @@ -143,10 +146,16 @@ private void poll()
 
     final DateTime timestamp = DateTimes.nowUtc();
     while (metadataSegments.hasNext()) {
-      final DataSegment interned = 
DataSegmentInterner.intern(metadataSegments.next());
+      final SegmentWithOvershadowedStatus segment = metadataSegments.next();
+      final DataSegment interned = 
DataSegmentInterner.intern(segment.getDataSegment());
+      final SegmentWithOvershadowedStatus segmentWithOvershadowedStatus = new 
SegmentWithOvershadowedStatus(
+          interned,
+          segment.isOvershadowed()
+      );
       // timestamp is used to filter deleted segments
-      publishedSegments.put(interned, timestamp);
 
 Review comment:
   omg, thanks for catching this issue, actually I feel like going with option 
(1), i didn't do it initially because of memory bump it'd cause like you said, 
but that would have avoided such bugs and updates the cache atomically. I tried 
option (2) as well, one thing it would cause is, the return type of 
`getPublishedSegments()` changes, so `CachedSegmentInfo` cannot be private to 
this class. The `getPublishedSegments()` might need to be split into 2 methods 
`getPublishedSegments()` and `getCachedPublishedSegments()` or create yet 
another wrapper class and return that.  Another potential ugliness it might 
have is clients need to know if cache is enabled and call the right method to 
get published segments.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to