Skip to content

Commit

Permalink
Don't remove all MPUs on start
Browse files Browse the repository at this point in the history
It was a bad idea, because GeeseFS may be not the only user of the bucket :-)
  • Loading branch information
vitalif committed Aug 17, 2021
1 parent 229c093 commit 7e1cb8c
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions internal/backend_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,17 +1086,25 @@ func (s *S3Backend) MultipartExpire(param *MultipartExpireInput) (*MultipartExpi
}
s3Log.Debug(mpu)

now := time.Now()
for _, upload := range mpu.Uploads {
// FIXME: Maybe keep parts with known etags if we load them from disk
params := &s3.AbortMultipartUploadInput{
Bucket: &s.bucket,
Key: upload.Key,
UploadId: upload.UploadId,
}
resp, err := s.AbortMultipartUpload(params)
s3Log.Debug(resp)
if mapAwsError(err) == syscall.EACCES {
break
expireTime := upload.Initiated.Add(48 * time.Hour)

if !expireTime.After(now) {
// FIXME: Maybe keep parts with known etags if we load them from disk
params := &s3.AbortMultipartUploadInput{
Bucket: &s.bucket,
Key: upload.Key,
UploadId: upload.UploadId,
}
resp, err := s.AbortMultipartUpload(params)
s3Log.Debug(resp)

if mapAwsError(err) == syscall.EACCES {
break
}
} else {
s3Log.Debugf("Keeping MPU Key=%v Id=%v", *upload.Key, *upload.UploadId)
}
}

Expand Down

0 comments on commit 7e1cb8c

Please sign in to comment.