navina commented on code in PR #10047:
URL: https://github.com/apache/pinot/pull/10047#discussion_r1198182331


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -53,14 +56,22 @@ public class ConcurrentMapPartitionUpsertMetadataManager 
extends BasePartitionUp
   @VisibleForTesting
   final ConcurrentHashMap<Object, RecordLocation> 
_primaryKeyToRecordLocationMap = new ConcurrentHashMap<>();
 
+  // keep track of all segments that haven't reach stable state to persist 
snapshot

Review Comment:
   Can you clarify what you mean by a "stable" state of a segment? 



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/PartitionUpsertMetadataManager.java:
##########
@@ -84,6 +84,16 @@ public interface PartitionUpsertMetadataManager extends 
Closeable {
    */
   GenericRow updateRecord(GenericRow record, RecordInfo recordInfo);
 
+  /**
+   * Remove from the primary key index when the PK are expired if TTL is 
enabled.
+   */
+  void removeExpiredPrimaryKeys(Comparable expiredTimestamp);
+
+  /**
+   * Persist validDocIds snapshot when the validDocIds is stable if TTL is 
enabled.
+   */
+  void persistSnapshotForStableSegments(long expiredTimestamp);
+

Review Comment:
   Why is the `expiredTimestamp` in `removeExpiredPrimaryKeys` a `Comparable` , 
whereas it is a `long` in `persistSnapshotForStableSegments` ?



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -181,6 +198,55 @@ protected void removeSegment(IndexSegment segment, 
MutableRoaringBitmap validDoc
     }
   }
 
+  /**
+   * When TTL is enabled for upsert, this function is used to remove expired 
keys from the primary key indexes.
+   *
+   * When committing consuming segment, we replace the consuming segment with 
an immutable segments.
+   * After replaceSegment, we iterate over recordInfoIterator to find 
validDocIds that are expired (out-of-TTL).
+   * Primarykey expired when the comparison time value of the record is less 
or equal to (segmentEndTime - TTL).
+   *
+   * @param expiredTimestamp segmentEndTime - TTLTime (converted ttl time 
values in millis time unit)
+   * @return void
+   */
+  @Override
+  public void doRemoveExpiredPrimaryKeys(Comparable expiredTimestamp) {

Review Comment:
   +1 to the above. can you please call this out in the javadoc and in the oss 
pinot docs (when you get to it)?



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to