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