From 9710ded60fa29d3d12086348476fa9c09c00a638 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 2 Aug 2020 11:13:29 +0100 Subject: [PATCH] b2: automatically raise upload cutoff to avoid spurious error Before this change, if --b2-chunk-size was raised above 200M then this error would be produced: b2: upload cutoff: 200M is less than chunk size 1G This change automatically reaises --b2-upload-cutoff to be the value of --b2-chunk-size if it is below it, which stops this error being generated. Fixes #4475 --- backend/b2/b2.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/b2/b2.go b/backend/b2/b2.go index c15b02d93..307a45ea8 100644 --- a/backend/b2/b2.go +++ b/backend/b2/b2.go @@ -403,6 +403,10 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e if err != nil { return nil, err } + if opt.UploadCutoff < opt.ChunkSize { + opt.UploadCutoff = opt.ChunkSize + fs.Infof(nil, "b2: raising upload cutoff to chunk size: %v", opt.UploadCutoff) + } err = checkUploadCutoff(opt, opt.UploadCutoff) if err != nil { return nil, errors.Wrap(err, "b2: upload cutoff")