jihoonson commented on a change in pull request #6094: Introduce SystemSchema 
tables (#5989)
URL: https://github.com/apache/incubator-druid/pull/6094#discussion_r223203336
 
 

 ##########
 File path: 
sql/src/main/java/org/apache/druid/sql/calcite/schema/DruidSchema.java
 ##########
 @@ -103,9 +104,10 @@
   // Protects access to segmentSignatures, mutableSegments, 
segmentsNeedingRefresh, lastRefresh, isServerViewInitialized
   private final Object lock = new Object();
 
-  // DataSource -> Segment -> RowSignature for that segment.
-  // Use TreeMap for segments so they are merged in deterministic order, from 
older to newer.
-  private final Map<String, TreeMap<DataSegment, RowSignature>> 
segmentSignatures = new HashMap<>();
+  // DataSource -> Segment -> SegmentMetadataHolder(contains RowSignature) for 
that segment.
 
 Review comment:
   It depends on how latest result you want vs how simple you want to make 
this. If you want the very latest segment information, the very recent changes 
should be reflected to the query result. To do so, everything should be mutable 
and lock should be acquired before updating mutable objects. However, I don't 
think this is the case. System schema doesn't change so quickly like hundreds 
times in a second. 
   
   I think it's much better to make `SegmentMetadataHolder` immutable and 
`segmentMetadataInfo` as a normal map. `getSegmentMetadata()` should return an 
immutable map holding the snapshot of `SegmentMetadataHolder` under the `lock`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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