Skip to content

Commit 62b28d1

Browse files
authored
Merge pull request #85 from sinkingpoint/sinkingpoint/allow_disabling_checksums
s3: Allow turning off checksums in S3 Puts
2 parents ff7faac + 5ce1435 commit 62b28d1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
3535
- [#73](https://github.com/thanos-io/objstore/pull/73) Аdded file path to erros from DownloadFile
3636
- [#51](https://github.com/thanos-io/objstore/pull/51) Azure: Support using connection string authentication.
3737
- [#76](https://github.com/thanos-io/objstore/pull/76) GCS: Query for object names only in `Iter` to possibly improve performance when listing objects.
38+
- [#85](https://github.com/thanos-io/objstore/pull/85) S3: Allow checksum algorithm to be configured
3839

3940
### Changed
4041
- [#38](https://github.com/thanos-io/objstore/pull/38) *: Upgrade minio-go version to `v7.0.45`.

providers/s3/s3.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)