You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kfaraz (via GitHub)" <gi...@apache.org> on 2026/07/10 15:33:38 UTC
[PR] perf: Skip download of upgraded segments on historicals (druid)
kfaraz opened a new pull request, #19676:
URL: https://github.com/apache/druid/pull/19676
### Changes
### Pending items
- Complete self review
- Wire up the population of the `upgradedFromSegmentId` column (it might already be happening, atleast in the incremental cache)
- Add unit/embedded tests
<hr>
<!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] perf: Skip download of upgraded segments on historicals (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz closed pull request #19676: perf: Skip download of upgraded segments on historicals
URL: https://github.com/apache/druid/pull/19676
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] perf: Skip download of upgraded segments on historicals (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #19676:
URL: https://github.com/apache/druid/pull/19676#discussion_r3560193154
##########
server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:
##########
@@ -1663,6 +1671,71 @@ public File toPotentialLocation(final File location)
return new File(location, relativePathString);
}
+ /**
+ * Returns the cache directory of the base segment (the segment this one was upgraded from) on the given storage
+ * location if it is present and not corrupted, or null otherwise.
+ */
+ @GuardedBy("entryLock")
+ @Nullable
+ private File findCachedBaseSegmentDir(final StorageLocation mountLocation)
+ {
+ if (upgradedFromSegmentId == null) {
+ return null;
+ }
+ final File baseDir = new File(mountLocation.getPath(), upgradedFromSegmentId.toString());
+ if (baseDir.exists() && !isPossiblyCorrupted(baseDir)) {
+ return baseDir;
+ }
+ return null;
+ }
+
+ /**
+ * Copies files from the base segment's cache directory into the upgraded segment's cache directory,
+ * avoiding a deep-storage download. Uses a start-marker for crash safety, consistent with
+ * {@link #loadInLocationWithStartMarker}.
+ */
+ @GuardedBy("entryLock")
+ private void copyFromBaseSegmentDir(final File baseDir, final File destDir)
Review Comment:
This method needs to hold the `entryLock` for the base segment too.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] perf: Skip download of upgraded segments on historicals (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #19676:
URL: https://github.com/apache/druid/pull/19676#issuecomment-4959219367
The current approach is not desirable.
A better approach would be to key the segment cache on the load spec.
And use the load spec hash for the path of the segment files on disk.
There are still some details being discussed with @clintropolis .
Once those are finalized, this PR will be updated.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] perf: Skip download of upgraded segments on historicals (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on code in PR #19676:
URL: https://github.com/apache/druid/pull/19676#discussion_r3560189846
##########
server/src/main/java/org/apache/druid/segment/loading/SegmentLocalCacheManager.java:
##########
@@ -1479,7 +1482,12 @@ public void mount(StorageLocation mountLocation) throws SegmentLoadingException
}
}
if (needsLoad) {
- loadInLocationWithStartMarker(dataSegment, storageDir);
+ final File baseDir = findCachedBaseSegmentDir(mountLocation);
Review Comment:
This doesn't seem correct, the base segment could be in some other location too.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] perf: Skip download of upgraded segments on historicals (druid)
Posted by "kfaraz (via GitHub)" <gi...@apache.org>.
kfaraz commented on PR #19676:
URL: https://github.com/apache/druid/pull/19676#issuecomment-5177572860
Closing off this PR since the preferred solution would be to not have a separate segment file for the upgraded segments at all. It would be better to use the same segment files for both the upgraded and the original segment.
--
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@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org