kfaraz opened a new pull request, #18274:
URL: https://github.com/apache/druid/pull/18274

   ### Description
   
   Historical cloning can sometimes cause segment downloads to fail due to the 
load spec being null.
   Example:
   
   ```
   org.apache.druid.segment.loading.SegmentLoadingException: Exception loading 
segment[xyz]
        at 
org.apache.druid.server.coordination.SegmentLoadDropHandler.addSegment(SegmentLoadDropHandler.java:177)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.server.coordination.SegmentLoadDropHandler$1.lambda$addSegment$1(SegmentLoadDropHandler.java:333)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
 [?:?]
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
[?:?]
        at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 [?:?]
        at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 [?:?]
        at java.base/java.lang.Thread.run(Thread.java:840) [?:?]
   Caused by: java.lang.NullPointerException: Cannot invoke 
"org.apache.druid.segment.loading.LoadSpec.loadSegment(java.io.File)" because 
"loadSpec" is null
        at 
org.apache.druid.segment.loading.SegmentLocalCacheManager$SegmentCacheEntry.loadInLocation(SegmentLocalCacheManager.java:844)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.segment.loading.SegmentLocalCacheManager$SegmentCacheEntry.loadInLocationWithStartMarker(SegmentLocalCacheManager.java:824)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.segment.loading.SegmentLocalCacheManager$SegmentCacheEntry.mount(SegmentLocalCacheManager.java:751)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.segment.loading.SegmentLocalCacheManager.assignLocationAndMount(SegmentLocalCacheManager.java:593)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.segment.loading.SegmentLocalCacheManager.load(SegmentLocalCacheManager.java:357)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
io.imply.druid.query.lookup.DelegatingSegmentCacheManagerWithCallbacks.load(DelegatingSegmentCacheManagerWithCallbacks.java:72)
 ~[?:?]
        at 
org.apache.druid.server.SegmentManager.loadSegment(SegmentManager.java:268) 
~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        at 
org.apache.druid.server.coordination.SegmentLoadDropHandler.addSegment(SegmentLoadDropHandler.java:173)
 ~[druid-server-2025.10.0-iap.jar:2025.10.0-iap]
        ... 6 more
   ```
   
   I have not been able to reproduce this issue.
   Tried several things with the embedded test in this PR.
   The fix however would be to ensure that we send a loadable `DataSegment` to 
the clone,
   one with the `loadSpec` populated correctly.
   `TierSegmentBalancer.getLoadableSegment` already does something similar.
   
   ### Changes
   
   - Fix `CloneHistoricals` to send a loadable segment to the clones for loading
   - Add `HistoricalCloningTest` which uses embedded cluster
   
   <hr>
   
   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: [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]

Reply via email to