fix(scheduler): set EnableTaskIdBasedBlobDigest in preheat to match dfdaemon default, fixing preheat cache miss#4787
Open
jasoncai1227 wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4787 +/- ##
==========================================
+ Coverage 28.09% 28.14% +0.05%
==========================================
Files 232 233 +1
Lines 23136 23158 +22
==========================================
+ Hits 6499 6518 +19
- Misses 16197 16200 +3
Partials 440 440
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
added 3 commits
May 27, 2026 15:31
…fdaemon default, fixing preheat cache miss Signed-off-by: caich1 <caich1@chinatelecom.cn>
Signed-off-by: caich1 <caich1@chinatelecom.cn>
Signed-off-by: caich1 <caich1@chinatelecom.cn>
99a90db to
388b46e
Compare
Member
|
@jasoncai1227 Please fix lint. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a preheat cache miss issue caused by task ID mismatch between the scheduler's preheat requests and the dfdaemon client's default task ID calculation behavior.
Root Cause: When the dfdaemon client downloads OCI blob URLs (e.g.,
/v2/<repository>/blobs/sha256:<digest>), it defaultsenable_task_id_based_blob_digesttotrue(seeclient/dragonfly-client-util/src/request/mod.rs), which means the task ID is derived from the blob digest rather than the full URL. However, when the scheduler sends preheat requests, it does not setEnableTaskIdBasedBlobDigest, so the task ID is calculated usingTaskIDV2ByURLBased(based on the full URL). This results in different task IDs for the same blob, causing the preheated cache to be missed by subsequent dfdaemon downloads.Changes:
pkg/digest/digest.go— AddedIsBlobURL()andExtractFromBlobURL()utilities to detect OCI blob URLs and extract the digest from them, mirroring the Rust client'sis_blob_url()andBLOB_URL_REGEXinclient/dragonfly-client-util/src/digest/mod.rs.pkg/idgen/task_id.go— AddedTaskIDByBlobDigest()function that generates a task ID from the blob digest extracted from an OCI blob URL, consistent with the Rust client'sTaskIDParameter::BlobDigestBasedlogic.scheduler/job/job.go— Updated three preheat functions (preheatV2SingleSeedPeerByURL,PreheatAllSeedPeers,PreheatAllPeers) to:pkgdigest.IsBlobURL().idgen.TaskIDByBlobDigest()for task ID calculation.EnableTaskIdBasedBlobDigest: isBlobURLin theDownloadTaskRequestto align with the dfdaemon client's default behavior.pkg/digest/digest_test.go— Added unit tests forIsBlobURL()(9 cases) andExtractFromBlobURL()(7 cases), covering valid blob URLs with various schemes, query params, nested repositories, and invalid URLs.pkg/idgen/task_id_test.go— Added unit tests forTaskIDByBlobDigest()(7 cases), including a key test that verifies the same blob digest from different registries produces the same task ID.Motivation and Context
When preheating OCI container images, the scheduler and dfdaemon client calculate different task IDs for the same blob URL, causing preheated data to never be served to subsequent download requests. This is because:
enable_task_id_based_blob_digesttotruefor proxy requests, using the blob's SHA256 digest as the task ID for OCI blob URLs.TaskIDV2ByURLBasedwhich incorporates the full URL, producing a different task ID.This mismatch means preheat operations complete successfully (data is cached on seed peers), but when dfdaemon later downloads the same blob, it looks for a task ID based on the blob digest and cannot find the preheated data, resulting in a cache miss and redundant download.
Types of changes
Checklist