Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel download read cache #1962

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

sethiay
Copy link
Collaborator

@sethiay sethiay commented May 30, 2024

Description

Assumptions: If there is a file of size S bytes already present then it is safe for multiple threads to write into disjoint sets of ranges into the same file where each thread has its own file handle.

Link to the issue in case of a bug fix.

NA

Testing details

  1. Manual - NA
  2. Unit tests - NA
  3. Integration tests - NA

@sethiay sethiay force-pushed the parallel_download_read_cache branch from 62eee6d to b93aab2 Compare May 31, 2024 13:42
@sethiay sethiay force-pushed the parallel_download_read_cache branch from f5f9a0e to 326fa8f Compare June 1, 2024 05:59
if start < end {
// Parallely download different ranges not more than ReadChunkSize and
// not using go routines more than AsyncDownloadParallelism
asyncDownloaderErrors := make([]error, job.downloadParallelism)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead, we should use ErrGroup: https://medium.com/@yardenlaif/go-sync-or-go-home-errgroup-f91a0ee72d3f
(a) No need to maintain error of all the go-routines.
(b) Abort if any of the go routine returns error and returns the first error (if multiple go routines returns error).

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.

None yet

2 participants