You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "deepthi912 (via GitHub)" <gi...@apache.org> on 2025/08/29 03:58:39 UTC
[PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
deepthi912 opened a new pull request, #16710:
URL: https://github.com/apache/pinot/pull/16710
**Exception stacktrace:**
```
2025/08/29 01:41:29.832 WARN [ImmutableSegmentImpl] [pool-52-thread-2] Caught exception while persisting docIds to snapshot file: /home/pinot/data/index/UpsertsScaleTest2_Restarts_REALTIME/UpsertsScaleTest2_Restarts__1__2019__20250827T2211Z/v3/queryabledocids.bitmap.snapshot, skipping
java.lang.NullPointerException: Cannot invoke "org.apache.pinot.segment.spi.index.mutable.ThreadSafeMutableRoaringBitmap.getMutableRoaringBitmap()" because "docIds" is null
at org.apache.pinot.segment.local.indexsegment.immutable.ImmutableSegmentImpl.persistDocIdsSnapshot(ImmutableSegmentImpl.java:163)
at org.apache.pinot.segment.local.upsert.BasePartitionUpsertMetadataManager.doTakeSnapshot(BasePartitionUpsertMetadataManager.java:911)
```
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "deepthi912 (via GitHub)" <gi...@apache.org>.
deepthi912 commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2350389535
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
Review Comment:
Sometimes when loading a snapshot file: `loadDocIdsFromSnapshot` In many cases, we are handling it creating it as new ThreadSafeMutableRoaringBitmap() for null values, for the safer side I added this check to handle null values.
Also let's say we have segment compaction tasks running on a segment removing all the validDocs, but until next iteration this segment will have 0 validDocs. In such cases we might end up having null values I think where empty segments remain in Pinot until they are deleted by the next cycle of task generation.
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16710:
URL: https://github.com/apache/pinot/pull/16710#issuecomment-3235717657
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/16710?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `71.42857%` with `4 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 33.11%. Comparing base ([`c3ce1cf`](https://app.codecov.io/gh/apache/pinot/commit/c3ce1cff782a2ea479ef2ef6040c76cd4034998c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`ff26e45`](https://app.codecov.io/gh/apache/pinot/commit/ff26e45e35b7697026ce91c0562103b7af02faf7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/pinot/pull/16710?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...cal/upsert/BasePartitionUpsertMetadataManager.java](https://app.codecov.io/gh/apache/pinot/pull/16710?src=pr&el=tree&filepath=pinot-segment-local%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsegment%2Flocal%2Fupsert%2FBasePartitionUpsertMetadataManager.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91cHNlcnQvQmFzZVBhcnRpdGlvblVwc2VydE1ldGFkYXRhTWFuYWdlci5qYXZh) | 71.42% | [0 Missing and 4 partials :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16710?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (c3ce1cf) and HEAD (ff26e45). Click for more details.
>
> <details><summary>HEAD has 36 uploads less than BASE</summary>
>
>| Flag | BASE (c3ce1cf) | HEAD (ff26e45) |
>|------|------|------|
>|java-21|5|1|
>|unittests1|2|0|
>|unittests|4|1|
>|temurin|10|1|
>|unittests2|2|1|
>|integration|6|0|
>|integration1|2|0|
>|custom-integration1|2|0|
>|java-11|5|0|
>|integration2|2|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #16710 +/- ##
=============================================
- Coverage 63.36% 33.11% -30.25%
+ Complexity 1380 673 -707
=============================================
Files 3038 3038
Lines 177058 177062 +4
Branches 27163 27167 +4
=============================================
- Hits 112196 58638 -53558
- Misses 56249 113613 +57364
+ Partials 8613 4811 -3802
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-11](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `33.11% <71.42%> (-30.23%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `33.11% <71.42%> (-30.25%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `33.11% <71.42%> (-30.25%)` | :arrow_down: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/16710/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `33.11% <71.42%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/16710?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2309200855
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
+ : immutableSegment.getValidDocIds();
immutableSegment.persistDocIdsSnapshot(V1Constants.VALID_DOC_IDS_SNAPSHOT_FILE_NAME,
- immutableSegment.getValidDocIds());
+ validDocIdsBitMap);
if (_deleteRecordColumn != null) {
+ queryableDocIdsBitMap =
+ immutableSegment.getQueryableDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
+ : immutableSegment.getQueryableDocIds();
immutableSegment.persistDocIdsSnapshot(V1Constants.QUERYABLE_DOC_IDS_SNAPSHOT_FILE_NAME,
- immutableSegment.getQueryableDocIds());
+ queryableDocIdsBitMap);
}
_updatedSegmentsSinceLastSnapshot.remove(segment);
numImmutableSegments++;
- numPrimaryKeysInSnapshot += immutableSegment.getValidDocIds().getMutableRoaringBitmap().getCardinality();
+ numPrimaryKeysInSnapshot += validDocIdsBitMap.getMutableRoaringBitmap().getCardinality();
if (_deleteRecordColumn != null) {
numQueryableDocIdsInSnapshot +=
- immutableSegment.getQueryableDocIds().getMutableRoaringBitmap().getCardinality();
+ queryableDocIdsBitMap.getMutableRoaringBitmap().getCardinality();
}
Review Comment:
[nitpick] The variable `queryableDocIdsBitMap` is initialized to null but only used conditionally. Consider initializing it only when needed inside the if block to make the code clearer and avoid potential confusion.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -940,16 +947,21 @@ protected void doTakeSnapshot() {
continue;
}
try {
- segment.persistDocIdsSnapshot(V1Constants.VALID_DOC_IDS_SNAPSHOT_FILE_NAME, segment.getValidDocIds());
+ ThreadSafeMutableRoaringBitmap segmentQueryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap segmentValidDocIdsBitMap =
+ segment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap() : segment.getValidDocIds();
+ segment.persistDocIdsSnapshot(V1Constants.VALID_DOC_IDS_SNAPSHOT_FILE_NAME, segmentValidDocIdsBitMap);
if (_deleteRecordColumn != null) {
+ segmentQueryableDocIdsBitMap = segment.getQueryableDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
+ : segment.getQueryableDocIds();
segment.persistDocIdsSnapshot(V1Constants.QUERYABLE_DOC_IDS_SNAPSHOT_FILE_NAME,
- segment.getQueryableDocIds());
+ segmentQueryableDocIdsBitMap);
}
_updatedSegmentsSinceLastSnapshot.remove(segment);
numImmutableSegments++;
- numPrimaryKeysInSnapshot += segment.getValidDocIds().getMutableRoaringBitmap().getCardinality();
+ numPrimaryKeysInSnapshot += segmentValidDocIdsBitMap.getMutableRoaringBitmap().getCardinality();
if (_deleteRecordColumn != null) {
- numQueryableDocIdsInSnapshot += segment.getQueryableDocIds().getMutableRoaringBitmap().getCardinality();
+ numQueryableDocIdsInSnapshot += segmentQueryableDocIdsBitMap.getMutableRoaringBitmap().getCardinality();
}
Review Comment:
[nitpick] The variable `segmentQueryableDocIdsBitMap` is initialized to null but only used conditionally. Consider initializing it only when needed inside the if block to make the code clearer and avoid potential confusion.
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 merged PR #16710:
URL: https://github.com/apache/pinot/pull/16710
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "deepthi912 (via GitHub)" <gi...@apache.org>.
deepthi912 commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2350389535
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
Review Comment:
Sometimes when loading a snapshot file: `loadDocIdsFromSnapshot` In many cases, we are handling it creating it as new ThreadSafeMutableRoaringBitmap() for null values, for the safer side I added this check to handle null values.
Also let's say we have segment compaction tasks running on a segment removing all the validDocs, but until next iteration this segment will have 0 validDocs marking it EmptySegment. In such cases we might end up having null values I think where empty segments remain in Pinot until they are deleted by the next cycle of task generation.
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2350000623
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
Review Comment:
When will this be `null`? Should we persist an empty bitmap when it is `null`? Empty bitmap means the entire segment should be skipped
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "deepthi912 (via GitHub)" <gi...@apache.org>.
deepthi912 commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2350389535
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
Review Comment:
Sometimes when loading a snapshot file: `loadDocIdsFromSnapshot` In many cases, we are handling it creating it as new ThreadSafeMutableRoaringBitmap() for null values, for the safer side I added this check to handle null values.
Also let's say we have segment compaction tasks running on a segment removing all the validDocs, but until next iteration this segment will have 0 validDocs marking it EmptySegment. In such cases we might end up having null values I think where empty segments remain in Pinot until they are deleted by the next cycle of task generation.
Wondering if this addition would cause any issues in query performance or something? I am trying to understand : `Empty bitmap means the entire segment should be skipped` -- Isn't that what we want?
--
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
Re: [PR] Avoid NPE while persisting validDocId and queryableDocId bitmaps for Upsert Tables [pinot]
Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #16710:
URL: https://github.com/apache/pinot/pull/16710#discussion_r2350459956
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -905,18 +905,25 @@ protected void doTakeSnapshot() {
segmentsWithoutSnapshot.add(immutableSegment);
continue;
}
+ ThreadSafeMutableRoaringBitmap queryableDocIdsBitMap = null;
+ ThreadSafeMutableRoaringBitmap validDocIdsBitMap =
+ immutableSegment.getValidDocIds() == null ? new ThreadSafeMutableRoaringBitmap()
Review Comment:
We need to ensure when `validDocIds` is `null`, it always represent a segment without any valid docs. Trying to understand when will `validDocIds` be `null`. Does that happen when the segment contains 0 doc, i.e. is empty?
--
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