Skip to content

Conversation

@MichaHoffmann
Copy link
Contributor

DownloadDir has the option to ignore paths that we have already on disk. In theory that makes downloads resumable, but in practice this doesnt work because we delete everything if one download fails. This means if one chunk in 1TiB block fails to download for whatever reason we start all over.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

@MichaHoffmann MichaHoffmann force-pushed the mhoffmann/dont-cleanup-objects-after-directory-download-failed branch 3 times, most recently from 8e46b87 to 62f0fe9 Compare June 3, 2025 14:15
DownloadDir has the option to ignore paths that we have already on disk.
In theory that makes downloads resumable, but in practice this doesnt
work because we delete everything if one download fails. This means if
one chunk in 1TiB block fails to download for whatever reason we start
all over.

Signed-off-by: Michael Hoffmann <[email protected]>
@MichaHoffmann MichaHoffmann force-pushed the mhoffmann/dont-cleanup-objects-after-directory-download-failed branch from 62f0fe9 to 3bf609c Compare June 4, 2025 08:36
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

Leaving some comments. I lack context to judge whether the change is going to break anything though. Let me ask the Mimir team.

return downloadDir(ctx, logger, bkt, src, src, dst, options...)
}

func downloadDir(ctx context.Context, logger log.Logger, bkt BucketReader, originalSrc, src, dst string, options ...DownloadOption) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering first of all whether downloadDir shouldn't return immediately if ctx.Err() is non-nil. The reason is that downloadDir can be called recursively with a context from errgroup.WithContext, that gets canceled when one or more of the goroutines fail.

downloadedFiles = append(downloadedFiles, dst)
m.Unlock()
return nil
return DownloadFile(ctx, logger, bkt, name, dst)
Copy link
Contributor

@aknuds1 aknuds1 Jun 5, 2025

Choose a reason for hiding this comment

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

Does DownloadFile respect cancellation via ctx? It ought to, so download can halt when one or more gouroutines fail.

}

return nil
return g.Wait()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not calling g.Wait if err is non-nil? It seems wrong to me not to wait on the child gouroutines. I am also wondering whether a cancelable ctx should be created, that gets passed to errgroup.WithContext(ctx), and gets canceled when bkt.Iter returns an error. WDYT?

testutil.Assert(t, isReaderAt)
}

func TestDownloadDir_CleanUp(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you keep this test, and assert that the downloaded files are kept?

@aknuds1
Copy link
Contributor

aknuds1 commented Jun 13, 2025

The Mimir team's feedback is positive BTW (as already communicated in Slack) :)

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.

3 participants