From 60a7c2bfd1052f912918968234b04e06b45d9b92 Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Thu, 28 Sep 2023 10:28:49 +0800 Subject: [PATCH] issue 6880: set ParallelUploadAboveSize as MaxInt64 Signed-off-by: Lyndon-Li --- pkg/uploader/kopia/snapshot.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/uploader/kopia/snapshot.go b/pkg/uploader/kopia/snapshot.go index b207713f638..02129c9f0ba 100644 --- a/pkg/uploader/kopia/snapshot.go +++ b/pkg/uploader/kopia/snapshot.go @@ -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 @@ -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, @@ -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 {