Send the datasource when downloading a blob#704
Merged
Conversation
Blobs are now stored under a per-datasource prefix on the server. The server can still find a blob without knowing its datasource, but only by searching the repo's datasources one by one, so send the datasource we already have. This is purely an optimization: servers predating the parameter ignore it, and a datasource with no id yet (never saved) omits it and is served by the search path. Also stop the annotation test's blob mock from treating the query string as part of the blob hash. It derives the hash from the download url, unlike the real client, which caches by hash independently of the url.
📝 WalkthroughWalkthrough
ChangesDatasource-aware blob URLs
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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.
The server now stores data engine metadata blobs under a per-datasource prefix instead of a repo-wide one, so that deleting a datasource can actually delete its blobs.
The server can still serve a blob when it isn't told which datasource it belongs to — but only by checking the legacy location and then searching the repo's datasources one at a time. We already know the datasource here, so we may as well say so.
The change
blob_pathappends?datasource={id}, which lets the server go straight to the blob.This is an optimization, not a requirement. Nothing breaks without it, in either direction:
datasource=None.So this can ship on its own schedule; the server PR does not depend on it.
Testing
Two new tests in
tests/data_engine/test_datasource_state.py: the url carries the datasource, and a datasource without an id still produces a usable url. Full suite passes (355 tests).Also fixed the annotation test's blob mock, which derived the blob hash from the last path segment of the download url and so swallowed the query string. It now parses the url the way the server does — path for the hash, query separately. The real client is unaffected: it caches by hash, independently of the url.