From f406dbbb4d8da540892629a6f6926ff0a94ee9cf Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 22 Jul 2020 12:02:17 +0100 Subject: [PATCH] s3: add --s3-no-check-bucket for minimising rclone transactions and perms Fixes #4449 --- backend/s3/s3.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 364de40d1..5bdf765b4 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -923,6 +923,15 @@ In Ceph, this can be increased with the "rgw list buckets max chunk" option. `, Default: 1000, Advanced: true, + }, { + Name: "no_check_bucket", + Help: `If set don't attempt to check the bucket exists or create it + +This can be useful when trying to minimise the number of transactions +rclone does if you know the bucket exists already. +`, + Default: false, + Advanced: true, }, { Name: config.ConfigEncoding, Help: config.ConfigEncodingHelp, @@ -1001,6 +1010,7 @@ type Options struct { UseAccelerateEndpoint bool `config:"use_accelerate_endpoint"` LeavePartsOnError bool `config:"leave_parts_on_error"` ListChunk int64 `config:"list_chunk"` + NoCheckBucket bool `config:"no_check_bucket"` Enc encoder.MultiEncoder `config:"encoding"` MemoryPoolFlushTime fs.Duration `config:"memory_pool_flush_time"` MemoryPoolUseMmap bool `config:"memory_pool_use_mmap"` @@ -1786,6 +1796,9 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error { // makeBucket creates the bucket if it doesn't exist func (f *Fs) makeBucket(ctx context.Context, bucket string) error { + if f.opt.NoCheckBucket { + return nil + } return f.cache.Create(bucket, func() error { req := s3.CreateBucketInput{ Bucket: &bucket,