Skip to content

blob/azureblob: parallel downloads via driver.DownloaderAt - #3808

Merged
vangent merged 1 commit into
google:masterfrom
stanhu:sh-azureblob-parallel-download
Nov 2, 2026
Merged

vangent merged 1 commit into
google:masterfrom
stanhu:sh-azureblob-parallel-download

Conversation

@stanhu

@stanhu stanhu commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Builds on #3805 and #3806 (both merged). Rebased onto master; contains only its own change.

What

Implements driver.DownloaderAt in azureblob, so Bucket.Download into an *os.File (with AllowParallelDownload set) fetches Azure blobs with parallel blocks instead of a single stream.

How

Uses the azblob DownloadFile helper, a method on the same *blob.Client the driver already uses for DownloadStream, so no new import or dependency. It reuses the driver's existing client.

Azure's parallel download helpers only accept *os.File (DownloadFile) or []byte (DownloadBuffer); there is no parallel download into a generic io.WriterAt. So:

  • *os.File destination -> DownloadFile (parallel blocks).
  • any other io.WriterAt -> single sequential DownloadStream + copy, which is correct but not parallel.

ReaderOptions.BufferSize and MaxConcurrency (added in #3806) map onto DownloadFileOptions.BlockSize and Concurrency on the parallel path; both default to the azblob default. BeforeRead exposes *blob.DownloadFileOptions / *blob.Client on the parallel path, and *blob.DownloadStreamOptions on the fallback.

Testing

  • Builds, go vet, gofmt clean. Compile-time var _ driver.DownloaderAt = (*bucket)(nil) assertion.
  • The portable routing is unit-tested in blob (the AllowParallelDownload gate + DownloadAt).
  • SkipDownloadAt is true in the conformance harness for now; I don't have Azure credentials to record the DownloadAt interaction. Happy to drop that once someone with CI creds records it.

@vangent

vangent commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Please sync now that #3805 is merged.

@stanhu
stanhu force-pushed the sh-azureblob-parallel-download branch from bb7d34f to 7dba885 Compare November 1, 2026 06:39
@stanhu
stanhu marked this pull request as ready for review November 1, 2026 06:41
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.13%. Comparing base (fb08a36) to head (78a55b2).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
blob/azureblob/azureblob.go 0.00% 36 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3808      +/-   ##
==========================================
- Coverage   80.38%   80.13%   -0.26%     
==========================================
  Files         104      104              
  Lines       12405    12449      +44     
==========================================
+ Hits         9972     9976       +4     
- Misses       2432     2472      +40     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread blob/azureblob/azureblob.go Outdated
if err != nil {
return err
}
defer resp.Body.Close()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(the lint warning)

@vangent

vangent commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Please sync again, you probably will have to update SkipDownloadAt in azureblob_test.go to true to skip the conformance test for now.

Comment thread blob/azureblob/azureblob.go Resolved
@stanhu
stanhu force-pushed the sh-azureblob-parallel-download branch from fe9337f to 33cb6d1 Compare November 2, 2026 18:33
Implement DownloadAt using the azblob DownloadFile helper, a method on
the same *blob.Client the driver already uses, so this adds no new
import or dependency. When the destination is an *os.File it downloads
the blob in parallel blocks; for any other io.WriterAt it falls back to
a single sequential stream, since azblob has no parallel download into a
generic io.WriterAt.

ReaderOptions.BufferSize and MaxConcurrency map onto the DownloadFile
block size and concurrency; both default to the azblob default.

With this, blob.Bucket.Download into an *os.File (with
AllowParallelDownload set) fetches Azure blobs in parallel instead of on
a single stream.

SkipDownloadAt is set to true in the conformance harness for now, since
there is no recorded interaction for the DownloadAt test on Azure yet.

Part of google#3804
@stanhu
stanhu force-pushed the sh-azureblob-parallel-download branch from 33cb6d1 to 78a55b2 Compare November 2, 2026 18:35
@vangent
vangent merged commit 18e4aa5 into google:master Nov 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants