Jackie-Jiang commented on a change in pull request #3979: Track "freshness" 
timestamp across consuming segments
URL: https://github.com/apache/incubator-pinot/pull/3979#discussion_r282195516
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
 ##########
 @@ -149,6 +151,33 @@ public DataTable processQuery(ServerQueryRequest 
queryRequest, ExecutorService e
       TraceContext.register(requestId);
     }
 
+    int numConsuming = 0;
+    long minIndexTime = Long.MAX_VALUE;
+    long minIngestionTime = Long.MAX_VALUE;
+    // gather stats for realtime consuming segments
+    for (SegmentDataManager segmentMgr : segmentDataManagers) {
+      if (segmentMgr.getSegment() instanceof MutableSegment) {
+        numConsuming += 1;
+        SegmentMetadata metadata = 
segmentMgr.getSegment().getSegmentMetadata();
+        long indexedTime = metadata.getLastIndexedTimestamp();
+        if (indexedTime != Long.MIN_VALUE && indexedTime < minIndexTime) {
+          minIndexTime = metadata.getLastIndexedTimestamp();
+        }
+        long ingestionTime = metadata.getLatestIngestionTimestamp();
+        if (ingestionTime != Long.MIN_VALUE && ingestionTime < 
minIngestionTime) {
+          minIngestionTime = ingestionTime;
+        }
+      }
+    }
+
+    if (numConsuming > 0) {
+      if (minIngestionTime == Long.MAX_VALUE) {
+        LOGGER.debug("Did not find valid ingestionTimestamp across consuming 
segments! Using indexTime instead");
+        minIngestionTime = minIndexTime;
 
 Review comment:
   (Optional) Add an extra variable **minConsumingFreshnessTimeMs** to be more 
clear?

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