Skip to content

Commit 1b0a750

Browse files
AbortMPU to properly cleanup existing s3 object
- CompleteMPU was and is still, at the time of this commit, wrongly promoting s3 objects when completing a MPU even if the parts are not valid. - The AbortMPU cleanup logic was added as an effort to cleanup new occurences of this problem, and still handle old ones not yet aborted. - The logic currently is unable to clean up if the current master version has a different upload id: in case a new version was pushed, we end up never cleaning the ghost. - This commit introduces a dynamic listing of the versionIDs of the object. We use the delimiter versions algorithm and the versionID separator to list only the current object versions, with pagination support, and then we detect the one to cleanup. Issue: CLDSRV-669
1 parent d2fc810 commit 1b0a750

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/api/apiUtils/object/abortMultipartUpload.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,21 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
195195
versionId: objMDWithMatchingUploadID.versionId,
196196
}, log, err => {
197197
if (err) {
198-
log.error('error deleting object metadata', { error: err });
198+
// Handle concurrent deletion of this object metadata
199+
if (err.is?.NoSuchKey) {
200+
log.debug('object metadata already deleted or does not exist', {
201+
method: 'abortMultipartUpload',
202+
bucketName,
203+
objectKey,
204+
versionId: objMDWithMatchingUploadID.versionId,
205+
});
206+
} else {
207+
log.error('error deleting object metadata', { error: err });
208+
}
199209
}
200-
return next(err, mpuBucket, storedParts, destBucket, objMDWithMatchingUploadID, skipDataDelete);
210+
// Continue with the operation regardless of deletion success/failure
211+
// The important part is that we tried to clean up
212+
return next(null, mpuBucket, storedParts, destBucket, objMDWithMatchingUploadID, skipDataDelete);
201213
});
202214
},
203215
function deleteData(mpuBucket, storedParts, destBucket, objMDWithMatchingUploadID,

0 commit comments

Comments
 (0)