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

[1.12] Issue 6880: set ParallelUploadAboveSize as MaxInt64 #6886

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/6886-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set ParallelUploadAboveSize as MaxInt64 and flush repo after setting up policy so that policy is retrieved correctly by TreeForSource
12 changes: 11 additions & 1 deletion pkg/uploader/kopia/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ func newOptionalInt(b int) *policy.OptionalInt {
return &ob
}

func newOptionalInt64(b int64) *policy.OptionalInt64 {
ob := policy.OptionalInt64(b)
return &ob
}

func newOptionalBool(b bool) *policy.OptionalBool {
ob := policy.OptionalBool(b)
return &ob
Expand All @@ -88,7 +93,7 @@ func getDefaultPolicy() *policy.Policy {
},
UploadPolicy: policy.UploadPolicy{
MaxParallelFileReads: newOptionalInt(runtime.NumCPU()),
ParallelUploadAboveSize: nil,
ParallelUploadAboveSize: newOptionalInt64(math.MaxInt64),
},
SchedulingPolicy: policy.SchedulingPolicy{
Manual: true,
Expand All @@ -106,6 +111,11 @@ func setupDefaultPolicy(ctx context.Context, rep repo.RepositoryWriter, sourceIn
return nil, errors.Wrap(err, "error to set policy")
}

err = rep.Flush(ctx)
if err != nil {
return nil, errors.Wrap(err, "error to flush repo")
}

// retrieve policy from repo
policyTree, err := treeForSourceFunc(ctx, rep, sourceInfo)
if err != nil {
Expand Down
Loading