J-HowHuang opened a new pull request, #19230:
URL: https://github.com/apache/pinot/pull/19230
#19212 replaced the per-column `File.exists()` probes in
`TextIndexHandler#getColumnsWithLegacyNativeTextIndex` with a single directory
listing. The old form was accidentally null-tolerant — `new File((File) null,
name).exists()` resolves against the default directory and returns `false` — so
a `SegmentDirectory` whose `SegmentMetadata` reports no local index dir simply
returned an empty set. The listing form calls `File#list()` on that null:
```
java.lang.NullPointerException: Cannot invoke "java.io.File.list()" because
"dir" is null
at TextIndexUtils.listEntryNames(TextIndexUtils.java:156)
at
TextIndexUtils.getColumnsWithLegacyNativeTextIndex(TextIndexUtils.java:143)
at
TextIndexHandler.getColumnsWithLegacyNativeTextIndex(TextIndexHandler.java:387)
at SegmentPreProcessor.needProcess(SegmentPreProcessor.java:219)
at ImmutableSegmentLoader.needPreprocess(ImmutableSegmentLoader.java:285)
```
`SegmentDirectory` does not guarantee a local directory — implementations
may serve segments from remote storage — and `needUpdateIndices` runs on every
reload check, so affected segments fail to load entirely.
**Fix:** guard at the caller. Legacy native text indexes are sidecar files
of the on-disk segment formats, so a segment with no local directory has none
by definition. Guarding there rather than only inside `listEntryNames` also
avoids resolving the version sub-directory from a null parent, which yields a
path relative to the working directory for v3 and another null for v1/v2 — the
latter NPEs on `File#equals` before the listing is even reached.
`listEntryNames` in `TextIndexUtils` and `VectorIndexUtils` now tolerate a
null directory as well, honoring the contract their javadoc already states.
**Testing:** new
`TextIndexHandlerTest#testNeedUpdateIndicesWithoutLocalIndexDir` drives the
real `needUpdateIndices` path with a `SegmentDirectory` whose metadata has no
index dir, over both v1 and v3. Without the fix it reproduces the NPE above for
v3 and the `File#equals` NPE for v1; with it, both pass. `TextIndexUtilsTest`
covers the unlistable/null-dir contract directly.
--
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]