You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "deemoliu (via GitHub)" <gi...@apache.org> on 2023/02/07 22:44:23 UTC

[GitHub] [pinot] deemoliu commented on a diff in pull request #10047: [WIP] Add upsert ttl configs for Pinot upsert optimizations

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


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -217,6 +226,17 @@ public void replaceSegment(ImmutableSegment segment, @Nullable ThreadSafeMutable
         }
         addOrReplaceSegment((ImmutableSegmentImpl) segment, validDocIds, recordInfoIterator, oldSegment,
             validDocIdsForOldSegment);
+
+        // remove expired primary keys from primary key indexes.
+        if (_upsertTTLStrategy != null) {
+          removeExpiredPrimaryKeys(segment, recordInfoIterator, _upsertTTLStrategy.getTtlInMs());
+          MutableRoaringBitmap validDocIdsSnapshot =

Review Comment:
   Thanks @Jackie-Jiang I think i can fix this logic by the following two changes.
   - iterating primary key indexes to remove out-of-dated PKs, instead of iterating the recordInfoIterator 
   - make sure the expired PK removal should be done before the new consuming segment might already be created.
   Is there anything I missed.



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -217,6 +226,17 @@ public void replaceSegment(ImmutableSegment segment, @Nullable ThreadSafeMutable
         }
         addOrReplaceSegment((ImmutableSegmentImpl) segment, validDocIds, recordInfoIterator, oldSegment,
             validDocIdsForOldSegment);
+
+        // remove expired primary keys from primary key indexes.
+        if (_upsertTTLStrategy != null) {
+          removeExpiredPrimaryKeys(segment, recordInfoIterator, _upsertTTLStrategy.getTtlInMs());
+          MutableRoaringBitmap validDocIdsSnapshot =

Review Comment:
   Thanks @Jackie-Jiang I think i can fix this logic by the following two changes.
   - iterating primary key indexes to remove out-of-dated PKs, instead of iterating the recordInfoIterator 
   - make sure the expired PK removal should be done before the new consuming segment might already be created.
   Is there anything I missed?



-- 
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-unsubscribe@pinot.apache.org

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


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