FS: sync abortMultipart cleanup and bg append (#3388)

backgroundAppend type's abort method should wait for appendParts to finish
writing ongoing appending of parts in the background before cleaning up
the part files.
master
Krishnan Parthasarathi 8 years ago committed by Harshavardhana
parent d31f256020
commit 67509453d3
  1. 5
      cmd/fs-v1-background-append.go
  2. 3
      cmd/fs-v1-multipart.go

@ -115,13 +115,14 @@ func (b *backgroundAppend) complete(disk StorageAPI, bucket, object, uploadID st
// Called after complete-multipart-upload or abort-multipart-upload so that the appendParts go-routine is not left dangling. // Called after complete-multipart-upload or abort-multipart-upload so that the appendParts go-routine is not left dangling.
func (b *backgroundAppend) abort(uploadID string) { func (b *backgroundAppend) abort(uploadID string) {
b.Lock() b.Lock()
defer b.Unlock()
info, ok := b.infoMap[uploadID] info, ok := b.infoMap[uploadID]
if !ok { if !ok {
b.Unlock()
return return
} }
delete(b.infoMap, uploadID) delete(b.infoMap, uploadID)
close(info.abortCh) b.Unlock()
info.abortCh <- struct{}{}
} }
// This is run as a go-routine that appends the parts in the background. // This is run as a go-routine that appends the parts in the background.

@ -637,11 +637,12 @@ func (fs fsObjects) CompleteMultipartUpload(bucket string, object string, upload
// the directory at '.minio.sys/multipart/bucket/object/uploadID' holding // the directory at '.minio.sys/multipart/bucket/object/uploadID' holding
// all the upload parts. // all the upload parts.
func (fs fsObjects) abortMultipartUpload(bucket, object, uploadID string) error { func (fs fsObjects) abortMultipartUpload(bucket, object, uploadID string) error {
// Signal appendParts routine to stop waiting for new parts to arrive.
fs.bgAppend.abort(uploadID)
// Cleanup all uploaded parts. // Cleanup all uploaded parts.
if err := cleanupUploadedParts(bucket, object, uploadID, fs.storage); err != nil { if err := cleanupUploadedParts(bucket, object, uploadID, fs.storage); err != nil {
return err return err
} }
fs.bgAppend.abort(uploadID)
// remove entry from uploads.json with quorum // remove entry from uploads.json with quorum
if err := fs.removeUploadID(bucket, object, uploadID); err != nil { if err := fs.removeUploadID(bucket, object, uploadID); err != nil {
return toObjectErr(err, bucket, object) return toObjectErr(err, bucket, object)

Loading…
Cancel
Save