tibrewalpratik17 commented on code in PR #13415:
URL: https://github.com/apache/pinot/pull/13415#discussion_r1643407706
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapTableUpsertMetadataManager.java:
##########
@@ -59,9 +62,21 @@ public Map<Integer, Long> getPartitionToPrimaryKeyCount() {
@Override
public void setSegmentContexts(List<SegmentContext> segmentContexts,
Map<String, String> queryOptions) {
- _partitionMetadataManagerMap.forEach(
- (partitionID, upsertMetadataManager) ->
upsertMetadataManager.setSegmentContexts(segmentContexts,
- queryOptions));
+ if (_consistencyMode != UpsertConfig.ConsistencyMode.NONE &&
!QueryOptionsUtils.isSkipUpsertView(queryOptions)) {
+ // Get queryableDocIds bitmaps from partitionMetadataManagers if any
consistency mode is used.
+ _partitionMetadataManagerMap.forEach(
+ (partitionID, upsertMetadataManager) ->
upsertMetadataManager.setSegmentContexts(segmentContexts,
+ queryOptions));
+ }
+ // If no consistency mode is used, we get queryableDocIds bitmaps as kept
by the segment objects directly.
+ // Even if consistency mode is used, we should still check if any segment
doesn't get its validDocIds bitmap,
+ // because partitionMetadataManagers may not track all segments of the
table, like those out of the metadata TTL.
+ for (SegmentContext segmentContext : segmentContexts) {
+ if (segmentContext.getQueryableDocIdsSnapshot() == null) {
+ IndexSegment segment = segmentContext.getIndexSegment();
+
segmentContext.setQueryableDocIdsSnapshot(UpsertUtils.getQueryableDocIdsSnapshotFromSegment(segment));
+ }
+ }
Review Comment:
This is neat! Thanks for this fix!
--
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]