@@ -113,6 +113,7 @@ var DefaultConfig = Config{
113113 },
114114 PartSize : 1024 * 1024 * 64 , // 64MB.
115115 BucketLookupType : AutoLookup ,
116+ SendContentMd5 : true , // Default to using MD5.
116117}
117118
118119// HTTPConfig exists here only because Cortex depends on it, and we depend on Cortex.
@@ -136,6 +137,7 @@ type Config struct {
136137 TraceConfig TraceConfig `yaml:"trace"`
137138 ListObjectsVersion string `yaml:"list_objects_version"`
138139 BucketLookupType BucketLookupType `yaml:"bucket_lookup_type"`
140+ SendContentMd5 bool `yaml:"send_content_md5"`
139141 // PartSize used for multipart upload. Only used if uploaded object size is known and larger than configured PartSize.
140142 // NOTE we need to make sure this number does not produce more parts than 10 000.
141143 PartSize uint64 `yaml:"part_size"`
@@ -166,6 +168,7 @@ type Bucket struct {
166168 storageClass string
167169 partSize uint64
168170 listObjectsV1 bool
171+ sendContentMd5 bool
169172}
170173
171174// parseConfig unmarshals a buffer into a Config with default values.
@@ -334,6 +337,7 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string) (*B
334337 storageClass : storageClass ,
335338 partSize : config .PartSize ,
336339 listObjectsV1 : config .ListObjectsVersion == "v1" ,
340+ sendContentMd5 : config .SendContentMd5 ,
337341 }
338342 return bkt , nil
339343}
@@ -510,6 +514,7 @@ func (b *Bucket) Upload(ctx context.Context, name string, r io.Reader) error {
510514 ServerSideEncryption : sse ,
511515 UserMetadata : userMetadata ,
512516 StorageClass : b .storageClass ,
517+ SendContentMd5 : b .sendContentMd5 ,
513518 // 4 is what minio-go have as the default. To be certain we do micro benchmark before any changes we
514519 // ensure we pin this number to four.
515520 // TODO(bwplotka): Consider adjusting this number to GOMAXPROCS or to expose this in config if it becomes bottleneck.
0 commit comments