Skip to content

Replace segmentDirectoryConfigs map with ReadMode in SegmentDirectoryLoaderContext#18806

Merged
Jackie-Jiang merged 1 commit into
apache:masterfrom
Jackie-Jiang:segment-directory-loader-context-readmode
Jun 18, 2026
Merged

Replace segmentDirectoryConfigs map with ReadMode in SegmentDirectoryLoaderContext#18806
Jackie-Jiang merged 1 commit into
apache:masterfrom
Jackie-Jiang:segment-directory-loader-context-readmode

Conversation

@Jackie-Jiang

Copy link
Copy Markdown
Contributor

Summary

SegmentDirectoryLoaderContext.segmentDirectoryConfigs was a Map<String, String> that in practice only ever held a single readMode entry (built by IndexLoadingConfig as Map.of(READ_MODE_KEY, readMode) and read back via ReadMode.valueOf(map.get(READ_MODE_KEY))). This replaces the stringly-typed map with a typed ReadMode field.

Changes:

  • SegmentDirectoryLoaderContext: add a ReadMode field (builder defaults to ReadMode.DEFAULT_MODE); remove getSegmentDirectoryConfigs() / setSegmentDirectoryConfigs().
  • DefaultSegmentDirectoryLoader / TierBasedSegmentDirectoryLoader: read context.getReadMode() directly instead of parsing the map.
  • Remove IndexLoadingConfig.getSegmentDirectoryConfigs(); update all builder call sites to setReadMode(...).
  • SegmentLocalFSDirectory: consolidate constructors around (File, SegmentMetadataImpl, ReadMode, @Nullable SegmentDirectoryLoaderContext).

This changes the public SegmentDirectoryLoaderContext SPI consumed by custom SegmentDirectoryLoader implementations. ReadMode.DEFAULT_MODE resolves to mmap, so default behavior is unchanged.

…LoaderContext

SegmentDirectoryLoaderContext's segmentDirectoryConfigs was a Map<String, String> that only
ever carried a single "readMode" entry. Replace it with a typed ReadMode field.

- Add ReadMode to the context and builder (defaults to ReadMode.DEFAULT_MODE); remove
  getSegmentDirectoryConfigs()/setSegmentDirectoryConfigs().
- DefaultSegmentDirectoryLoader and TierBasedSegmentDirectoryLoader now read context.getReadMode()
  directly instead of parsing the map.
- Remove IndexLoadingConfig.getSegmentDirectoryConfigs() and update all builder call sites to
  setReadMode(...).
@Jackie-Jiang Jackie-Jiang added the cleanup Code cleanup or removal of dead code label Jun 18, 2026
@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.76471% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.79%. Comparing base (d469cb1) to head (719b214).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
...not/server/predownload/PredownloadSegmentInfo.java 9.09% 10 Missing ⚠️
...sks/refreshsegment/RefreshSegmentTaskExecutor.java 0.00% 8 Missing ⚠️
...local/segment/creator/impl/BaseSegmentCreator.java 50.00% 5 Missing ⚠️
.../pinot/core/data/manager/BaseTableDataManager.java 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18806      +/-   ##
============================================
+ Coverage     64.78%   64.79%   +0.01%     
  Complexity     1309     1309              
============================================
  Files          3381     3386       +5     
  Lines        209967   210089     +122     
  Branches      32891    32913      +22     
============================================
+ Hits         136020   136136     +116     
- Misses        62979    62990      +11     
+ Partials      10968    10963       -5     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.79% <71.76%> (+0.01%) ⬆️
temurin 64.79% <71.76%> (+0.01%) ⬆️
unittests 64.79% <71.76%> (+0.01%) ⬆️
unittests1 56.96% <89.39%> (+<0.01%) ⬆️
unittests2 37.28% <51.76%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jackie-Jiang Jackie-Jiang merged commit dd28703 into apache:master Jun 18, 2026
18 of 21 checks passed
@Jackie-Jiang Jackie-Jiang deleted the segment-directory-loader-context-readmode branch June 18, 2026 22:16
cypherean pushed a commit to cypherean/pinot that referenced this pull request Jun 24, 2026
xiangfu0 pushed a commit that referenced this pull request Jun 27, 2026
#18863)

PR #18806 inadvertently dropped the segmentLoaderContext argument when
constructing SegmentLocalFSDirectory, leaving SingleFileIndexDirectory's
_segmentDirectoryLoaderContext field null. This causes the task-config
propagation logic added in PR #18264
(SingleFileIndexDirectory#serializeTaskConfigToJsonFromContext) to
short-circuit at its first guard, so task.config.json is never injected
into EmptyIndexBuffer.properties and downstream consumers silently fall
back to ambient credential defaults.

Restore the prior behavior by constructing SegmentMetadataImpl and
passing both the metadata and the loader context to SegmentLocalFSDirectory's
4-arg constructor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code cleanup or removal of dead code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants