You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "rohityadav1993 (via GitHub)" <gi...@apache.org> on 2026/05/11 18:49:11 UTC
[PR] Avoid mmap during predownload local segment check to reduce page faults [pinot]
rohityadav1993 opened a new pull request, #18467:
URL: https://github.com/apache/pinot/pull/18467
## Summary
`PredownloadScheduler.loadSegmentsFromLocal()` previously opened a full `SegmentLocalFSDirectory` with `ReadMode.mmap` for each segment to read its CRC. For a segment with C columns and ~5 index types, this triggers ~C×5 major page faults per segment (one per index chunk boundary validated by `SingleFileIndexDirectory.mapBufferEntries`). With P parallel threads, the total page fault rate scales to ~C×5×P per batch — on hosts with thousands of segments this creates a page fault storm at startup.
The CRC check exists to determine whether a segment has already been downloaded to local disk from deep store, so it can be skipped during predownload. The CRC value is pre-written to `creation.meta` (8 bytes) during segment build and does not require mmapping index files. This PR replaces the `SegmentDirectory` open with a direct read of `creation.meta` via `DataInputStream`, and replaces `getDiskSizeBytes()` with `FileUtils.sizeOfDirectory()` for the post-download size metric. Both Phase 1 (local CRC check) and Phase 2 (post-download size reporting) now use this optimised path through `loadSegmentFromLocal`.
If a segment's CRC matches but the local segment directory is corrupted (e.g. truncated or missing index files), the server startup path handles recovery: `BaseTableDataManager.addNewOnlineSegment` calls `tryLoadExistingSegment`, which performs a full segment load. If loading fails, it falls back to `downloadAndLoadSegment` to re-fetch the segment from deep store or peers.
This PR also adds a `Preconditions.checkArgument(segDir.isDirectory())` guard in `updateSegmentInfoFromLocal()` to enforce the directory contract explicitly, with corresponding test updates.
## Problem
When `PredownloadScheduler` checks if segments already exist locally (Phase 1), it opens each segment directory via `SegmentLocalFSDirectory(dir, ReadMode.mmap)`. This triggers `SingleFileIndexDirectory.mapBufferEntries()` which mmaps the entire index file and validates magic markers at every chunk boundary — causing a major page fault per index entry (~C×5 per segment, where C is the number of columns). With P concurrent threads across thousands of segments, the aggregate fault rate becomes ~C×5×P, producing a page fault storm that stalls predownload startup.
After downloading segments (Phase 2), the scheduler calls `loadSegmentFromLocal()` again solely to populate the local size metric — mmapping a freshly-written cold segment and causing another round of major page faults per segment.
## Fix
**Phase 1 — CRC check**: The CRC is only needed to check whether a segment was already downloaded to local disk. Replace `SegmentDirectory` open with a direct 8-byte read from `creation.meta`. Zero mmap, zero major page faults.
**Phase 2 — post-download size**: Replace `getDiskSizeBytes()` with `FileUtils.sizeOfDirectory()`. No mmap needed for a directory size walk.
**Preconditions**: Add `Preconditions.checkArgument(segDir.isDirectory())` in `updateSegmentInfoFromLocal()` to fail fast on invalid paths. `loadSegmentFromLocal()` now checks `segDir.isDirectory()` before delegating.
## Cluster Testing Results
Tested on hosts with ~5TB of segment data (thousands of segments), 48 cores, and 266GB memory. Comparing stream+untar configurations to isolate the download path overhead:
| Setup | Pagefault Fix | Predownload Duration | iowait | Dirty Pages (avg) | Major Faults Δ |
|---|---|---|---|---|---|
| S1 — 48 parallelism + stream+untar | No | 33 min | 0.05% | 0.1 GB | Near-zero baseline |
| S5 — 48 parallelism + stream+untar + fix | **Yes** | **31 min** | **0.2%** | **~0 GB** | **−3% (flat)** |
Without stream+untar (isolating the page fault fix impact):
| Setup | Pagefault Fix | Predownload Duration | iowait | Dirty Pages (avg) | Major Faults Δ |
|---|---|---|---|---|---|
| S3 — 48 parallelism | No | 79 min | 29% | 132 GB | +∞ (from 0, peak 10K/s) |
| S4 — 48 parallelism + fix | **Yes** | **63 min** | **8.0%** | **113 GB** | **−10% (flat)** |
Key findings:
- **Pagefault fix prevents mmap during predownload** — major faults stay flat or decrease during predownload (S4: −10%, S5: −3%)
- **Without the fix**, major fault spikes up to 10,011/s during predownload (S3)
- **Combined with stream+untar**, the fix delivers the best result: 31 min predownload, ~0% iowait, zero dirty-page backlog (S5)
- **Serving disk reads are completely isolated** from predownload writes in all setups (+0-1%)
## Test plan
- [x] Unit tests for `PredownloadSegmentInfoTest` — updated to verify `Preconditions` throws on non-directory paths and regular files
- [x] Unit tests for `PredownloadTableInfoTest` — existing tests cover CRC match/mismatch and missing segment scenarios
- [x] All 7 tests pass: `./mvnw -pl pinot-server -am -Dtest=PredownloadSegmentInfoTest,PredownloadTableInfoTest test`
- [x] Cluster testing on 5TB hosts validates page fault elimination
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "tarun11Mavani (via GitHub)" <gi...@apache.org>.
tarun11Mavani commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3266044083
##########
pinot-server/src/main/java/org/apache/pinot/server/predownload/PredownloadTableInfo.java:
##########
@@ -64,44 +52,42 @@ public InstanceDataManagerConfig getInstanceDataManagerConfig() {
}
/**
- * After loading segment metadata from ZK, try to load from local and check if we are able to skip
- * the downloading
+ * Checks whether the segment already exists locally with a matching CRC, and if so populates
+ * its local size. Reads CRC directly from {@code creation.meta} and size from directory
+ * traversal — no mmap of index files is performed (segment loading).
+ *
+ * <p>Note: a CRC match does not guarantee segment integrity. If the local segment directory is
+ * corrupted (e.g. truncated index files), the server startup path handles recovery:
+ * {@link org.apache.pinot.core.data.manager.BaseTableDataManager#addNewOnlineSegment} calls
+ * {@link org.apache.pinot.core.data.manager.BaseTableDataManager#tryLoadExistingSegment}, which
+ * performs a full segment load. If loading fails, it falls back to
+ * {@link org.apache.pinot.core.data.manager.BaseTableDataManager#downloadAndLoadSegment} to
+ * re-fetch the segment from deep store or peers.
*
- * @param predownloadSegmentInfo SegmentInfo of segment to be loaded
- * @return true if already presents, false if needs to be downloaded
+ * @param predownloadSegmentInfo SegmentInfo of segment to be checked
+ * @return true if the segment is present with matching CRC (download can be skipped),
+ * false if it is missing or has a CRC mismatch
Review Comment:
Use md style doc for java doc.
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #18467:
URL: https://github.com/apache/pinot/pull/18467#issuecomment-4424619516
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/18467?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 `84.00000%` with `4 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 63.66%. Comparing base ([`5ebd445`](https://app.codecov.io/gh/apache/pinot/commit/5ebd445336ff295c231b02afa9f202418e296546?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`fdc4fe7`](https://app.codecov.io/gh/apache/pinot/commit/fdc4fe7d284793f6a7e1ccc8e40b9c462cc6f2c2?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/18467?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...not/server/predownload/PredownloadSegmentInfo.java](https://app.codecov.io/gh/apache/pinot/pull/18467?src=pr&el=tree&filepath=pinot-server%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fserver%2Fpredownload%2FPredownloadSegmentInfo.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VydmVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zZXJ2ZXIvcHJlZG93bmxvYWQvUHJlZG93bmxvYWRTZWdtZW50SW5mby5qYXZh) | 63.63% | [3 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pinot/pull/18467?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #18467 +/- ##
=============================================
+ Coverage 34.99% 63.66% +28.66%
- Complexity 869 1678 +809
=============================================
Files 3256 3256
Lines 199548 199546 -2
Branches 30986 30986
=============================================
+ Hits 69840 127035 +57195
+ Misses 123570 62378 -61192
- Partials 6138 10133 +3995
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/18467/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/18467/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/18467/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/18467/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/18467/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/18467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.66% <84.00%> (+28.66%)` | :arrow_up: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/18467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.66% <84.00%> (+28.66%)` | :arrow_up: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/18467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `63.66% <84.00%> (+28.66%)` | :arrow_up: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/18467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.71% <ø> (?)` | |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/18467/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `35.00% <84.00%> (+<0.01%)` | :arrow_up: |
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/18467?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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3263671674
##########
pinot-server/src/test/java/org/apache/pinot/server/predownload/PredownloadSchedulerTest.java:
##########
@@ -216,22 +217,25 @@ public void getSegmentsInfoWithoutCrypterName(PredownloadZKClient predownloadZkC
_predownloadScheduler.getSegmentsInfo();
}
- public void loadSegmentsFromLocal() {
- // Only segment 3 will be loaded
- SegmentDirectory segmentDirectory = mock(SegmentDirectory.class);
- SegmentMetadataImpl segmentMetadata = mock(SegmentMetadataImpl.class);
- when(segmentDirectory.getSegmentMetadata()).thenReturn(segmentMetadata);
- when(segmentDirectory.getDiskSizeBytes()).thenReturn(DISK_SIZE_BYTES);
- when(segmentMetadata.getCrc()).thenReturn(String.valueOf(CRC));
+ public void loadSegmentsFromLocal()
+ throws Exception {
+ // Only segment 3 will be loaded — create a real creation.meta with matching CRC
+ File seg3Dir = Files.createTempDirectory("predownload-seg3-predownload-seg3-").toFile();
+ File creationMeta = new File(seg3Dir, "creation.meta");
+ try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(creationMeta))) {
+ dos.writeLong(CRC);
+ dos.writeLong(0L);
+ }
when(_predownloadTableInfo.loadSegmentFromLocal(eq(_predownloadSegmentInfoList.get(2)))).thenAnswer(
invocation -> {
- _predownloadSegmentInfoList.get(2).updateSegmentInfoFromLocal(segmentDirectory);
+ _predownloadSegmentInfoList.get(2).updateSegmentInfoFromLocal(seg3Dir);
return true;
});
when(_predownloadTableInfo.loadSegmentFromLocal(eq(_predownloadSegmentInfoList.get(0)))).thenReturn(false);
when(_predownloadTableInfo.loadSegmentFromLocal(eq(_predownloadSegmentInfoList.get(1)))).thenReturn(false);
_predownloadScheduler.loadSegmentsFromLocal();
+ FileUtils.deleteQuietly(seg3Dir);
Review Comment:
Can we put this in `finally`? If `_predownloadScheduler.loadSegmentsFromLocal()` throws, this would not be executed.
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "chenboat (via GitHub)" <gi...@apache.org>.
chenboat commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3267933734
##########
pinot-server/src/main/java/org/apache/pinot/server/predownload/PredownloadSegmentInfo.java:
##########
@@ -172,9 +176,27 @@ public boolean hasSameCRC() {
}
}
- public void updateSegmentInfoFromLocal(@Nullable SegmentDirectory segmentDirectory) {
- SegmentMetadataImpl segmentMetadata = (segmentDirectory == null) ? null : segmentDirectory.getSegmentMetadata();
- _localCrc = (segmentMetadata == null) ? null : segmentMetadata.getCrc();
- _localSizeBytes = (segmentDirectory == null) ? 0 : segmentDirectory.getDiskSizeBytes();
+ /**
+ * Populates local CRC and size from the segment directory on disk, avoiding mmap of index files.
+ * Reads CRC from {@code creation.meta} (8 bytes) and computes size via directory traversal.
+ * Sets {@code _localCrc} to null and {@code _localSizeBytes} to 0 if the segment or its
+ * creation.meta does not exist.
+ */
+ public void updateSegmentInfoFromLocal(File segDir) {
+ if (!segDir.isDirectory()) {
+ LOGGER.warn("Segment path is not a directory: {}", segDir);
+ return;
+ }
+ File creationMeta = SegmentDirectoryPaths.findCreationMetaFile(segDir);
+ if (creationMeta == null || !creationMeta.exists()) {
+ return;
+ }
+ try (DataInputStream ds = new DataInputStream(new FileInputStream(creationMeta))) {
Review Comment:
To confirm, the first 8 bytes of creationMeta is CRC? Add a comment above this line could be help.
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3263674047
##########
pinot-server/src/test/java/org/apache/pinot/server/predownload/PredownloadSchedulerTest.java:
##########
@@ -216,22 +217,25 @@ public void getSegmentsInfoWithoutCrypterName(PredownloadZKClient predownloadZkC
_predownloadScheduler.getSegmentsInfo();
}
- public void loadSegmentsFromLocal() {
- // Only segment 3 will be loaded
- SegmentDirectory segmentDirectory = mock(SegmentDirectory.class);
- SegmentMetadataImpl segmentMetadata = mock(SegmentMetadataImpl.class);
- when(segmentDirectory.getSegmentMetadata()).thenReturn(segmentMetadata);
- when(segmentDirectory.getDiskSizeBytes()).thenReturn(DISK_SIZE_BYTES);
- when(segmentMetadata.getCrc()).thenReturn(String.valueOf(CRC));
+ public void loadSegmentsFromLocal()
+ throws Exception {
+ // Only segment 3 will be loaded — create a real creation.meta with matching CRC
+ File seg3Dir = Files.createTempDirectory("predownload-seg3-predownload-seg3-").toFile();
Review Comment:
`predownload-seg3-predownload-seg3-` is it intentional? could be `predownload-seg3`.
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3263662831
##########
pinot-server/src/main/java/org/apache/pinot/server/predownload/PredownloadSegmentInfo.java:
##########
@@ -172,9 +176,27 @@ public boolean hasSameCRC() {
}
}
- public void updateSegmentInfoFromLocal(@Nullable SegmentDirectory segmentDirectory) {
- SegmentMetadataImpl segmentMetadata = (segmentDirectory == null) ? null : segmentDirectory.getSegmentMetadata();
- _localCrc = (segmentMetadata == null) ? null : segmentMetadata.getCrc();
- _localSizeBytes = (segmentDirectory == null) ? 0 : segmentDirectory.getDiskSizeBytes();
+ /**
+ * Populates local CRC and size from the segment directory on disk, avoiding mmap of index files.
+ * Reads CRC from {@code creation.meta} (8 bytes) and computes size via directory traversal.
+ * Sets {@code _localCrc} to null and {@code _localSizeBytes} to 0 if the segment or its
+ * creation.meta does not exist.
+ */
+ public void updateSegmentInfoFromLocal(File segDir) {
+ if (!segDir.isDirectory()) {
+ LOGGER.warn("Segment path is not a directory: {}", segDir);
+ return;
+ }
+ File creationMeta = SegmentDirectoryPaths.findCreationMetaFile(segDir);
+ if (creationMeta == null || !creationMeta.exists()) {
+ return;
+ }
+ try (DataInputStream ds = new DataInputStream(new FileInputStream(creationMeta))) {
+ _localCrc = String.valueOf(ds.readLong());
+ } catch (IOException e) {
+ LOGGER.warn("Failed to read creation.meta for segment: {} of table: {}", _segmentName, _tableNameWithType, e);
+ return;
+ }
+ _localSizeBytes = FileUtils.sizeOfDirectory(segDir);
Review Comment:
Let's wrap this within a try-catch with `IllegalArgumentException`: a TOCTOU race could happen between the `!segDir.isDirectory()` check and the `FileUtils.sizeOfDirectory` if the directory itself is deleted.
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats commented on code in PR #18467:
URL: https://github.com/apache/pinot/pull/18467#discussion_r3263658702
##########
pinot-server/src/main/java/org/apache/pinot/server/predownload/PredownloadSegmentInfo.java:
##########
@@ -172,9 +176,27 @@ public boolean hasSameCRC() {
}
}
- public void updateSegmentInfoFromLocal(@Nullable SegmentDirectory segmentDirectory) {
- SegmentMetadataImpl segmentMetadata = (segmentDirectory == null) ? null : segmentDirectory.getSegmentMetadata();
- _localCrc = (segmentMetadata == null) ? null : segmentMetadata.getCrc();
- _localSizeBytes = (segmentDirectory == null) ? 0 : segmentDirectory.getDiskSizeBytes();
+ /**
+ * Populates local CRC and size from the segment directory on disk, avoiding mmap of index files.
+ * Reads CRC from {@code creation.meta} (8 bytes) and computes size via directory traversal.
+ * Sets {@code _localCrc} to null and {@code _localSizeBytes} to 0 if the segment or its
+ * creation.meta does not exist.
+ */
+ public void updateSegmentInfoFromLocal(File segDir) {
+ if (!segDir.isDirectory()) {
+ LOGGER.warn("Segment path is not a directory: {}", segDir);
+ return;
+ }
+ File creationMeta = SegmentDirectoryPaths.findCreationMetaFile(segDir);
+ if (creationMeta == null || !creationMeta.exists()) {
+ return;
Review Comment:
Can we add a warning log for more information?
--
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 mmap during predownload local segment check to reduce page faults [pinot]
Posted by "shauryachats (via GitHub)" <gi...@apache.org>.
shauryachats merged PR #18467:
URL: https://github.com/apache/pinot/pull/18467
--
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