xiangfu0 commented on code in PR #18478:
URL: https://github.com/apache/pinot/pull/18478#discussion_r3234046949
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/UpsertViewManager.java:
##########
@@ -306,6 +307,19 @@ Map<IndexSegment, MutableRoaringBitmap>
getSegmentQueryableDocIdsMap() {
return _segmentQueryableDocIdsMap;
}
+ /**
+ * Returns the queryable doc-id snapshot for the given segment from the most
recent refresh, or
+ * {@code null} if no refresh has happened yet or the segment is not in the
current view.
+ *
+ * <p>Lock-free: reads the volatile map reference and does a single lookup.
Writers replace the map
+ * reference atomically under {@link #_upsertViewLock} (write lock), so the
returned bitmap is the
+ * frozen snapshot of that refresh.
+ */
+ @Nullable
+ public MutableRoaringBitmap getQueryableDocIdsSnapshot(IndexSegment segment)
{
+ return _segmentQueryableDocIdsMap.get(segment);
Review Comment:
`UpsertUtils.hasNoQueryableDocs()` now calls
`segment.getQueryableDocIdsSnapshot()` before it checks
`isUpsertConsistencyModeEnabled()`, but this getter unconditionally
dereferences `_segmentQueryableDocIdsMap`. In `SYNC` mode that map is never
populated by the normal query path, and in `SNAPSHOT` mode it is still null
before the first refresh, so empty-segment pruning can throw
`NullPointerException` instead of conservatively returning `false`. Please
null-guard the map here (or only expose this getter once a snapshot map exists)
so consistency-mode tables do not regress into query failures.
--
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]