Merge pull request #6886 from Lyndon-Li/release-1.12

[1.12] Issue 6880: set ParallelUploadAboveSize as MaxInt64
This commit is contained in:
lyndon
2023-09-28 15:15:53 +08:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
Set ParallelUploadAboveSize as MaxInt64 and flush repo after setting up policy so that policy is retrieved correctly by TreeForSource
+11 -1
View File
@@ -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 {