mirror of
https://github.com/octoleo/restic.git
synced 2024-11-21 20:35:12 +00:00
S3: do not set storage class for metadata when using archive storage
This commit is contained in:
parent
62111f4379
commit
8ca58b487c
9
changelog/unreleased/issue-4583
Normal file
9
changelog/unreleased/issue-4583
Normal file
@ -0,0 +1,9 @@
|
||||
Bugfix: Ignoring the s3.storage-class option for metadata when archive tier is specified
|
||||
|
||||
Restic now will save snapshot metadata to non-archive storage tier whatsoever,
|
||||
this will help avoid issues when data is being saved to archive storage class.
|
||||
It is not providing any support for cold storages in restic,
|
||||
only saving users from making backups unusable.
|
||||
|
||||
https://github.com/restic/restic/issues/4583
|
||||
https://github.com/restic/restic/issues/3202
|
@ -325,12 +325,22 @@ func (be *Backend) Path() string {
|
||||
return be.cfg.Prefix
|
||||
}
|
||||
|
||||
// useStorageClass returns whether file should be saved in the provided Storage Class
|
||||
func (be *Backend) useStorageClass(h backend.Handle) bool {
|
||||
var notArchiveClass bool = be.cfg.StorageClass != "GLACIER" && be.cfg.StorageClass != "DEEP_ARCHIVE"
|
||||
isDataFile := h.Type == backend.PackFile && !h.IsMetadata
|
||||
return isDataFile || notArchiveClass
|
||||
}
|
||||
|
||||
// Save stores data in the backend at the handle.
|
||||
func (be *Backend) Save(ctx context.Context, h backend.Handle, rd backend.RewindReader) error {
|
||||
objName := be.Filename(h)
|
||||
|
||||
opts := minio.PutObjectOptions{StorageClass: be.cfg.StorageClass}
|
||||
opts.ContentType = "application/octet-stream"
|
||||
opts := minio.PutObjectOptions{ContentType: "application/octet-stream"}
|
||||
|
||||
if be.useStorageClass(h) {
|
||||
opts.StorageClass = be.cfg.StorageClass
|
||||
}
|
||||
// the only option with the high-level api is to let the library handle the checksum computation
|
||||
opts.SendContentMd5 = true
|
||||
// only use multipart uploads for very large files
|
||||
|
Loading…
Reference in New Issue
Block a user