Jackie-Jiang commented on code in PR #19512:
URL: https://github.com/apache/pinot/pull/19512#discussion_r3981503994


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/dedup/BasePartitionDedupMetadataManager.java:
##########
@@ -167,7 +167,11 @@ public void preloadSegment(ImmutableSegment segment) {
       return;
     }
     try {
-      if (skipSegmentOutOfTTL(segment, true)) {
+      // Bump watermark after doPreloadSegment; a concurrent 
removeExpiredPrimaryKeys sweep reading a pre-bumped
+      // watermark could expire keys this preload is about to insert. On the 
skip path no rows are added, so it is
+      // safe to bump before returning.
+      if (skipSegmentOutOfTTL(segment)) {
+        updateLargestSeenTime(segment);
         return;
       }
       try (DedupUtils.DedupRecordInfoReader dedupRecordInfoReader = new 
DedupUtils.DedupRecordInfoReader(segment,

Review Comment:
   (minor) Remove the previous check and put this in 
`if(!skipSegmentOutOfTTL(segment))` for better readability



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/dedup/BasePartitionDedupMetadataManager.java:
##########
@@ -203,8 +208,12 @@ public void addSegment(IndexSegment segment) {
       return;
     }
     try {
-      if (!skipSegmentOutOfTTL(segment, true)) {
+      // Bump watermark after add; see preloadSegment.
+      if (skipSegmentOutOfTTL(segment)) {
+        updateLargestSeenTime(segment);
+      } else {
         addOrReplaceSegment(null, segment);
+        updateLargestSeenTime(segment);
       }

Review Comment:
   (minor) Can be simplified, same for other places
   ```suggestion
         if (!skipSegmentOutOfTTL(segment)) {
           addOrReplaceSegment(null, segment);
         }
         updateLargestSeenTime(segment);
   ```



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