Skip to content

Commit

Permalink
Fix handling of archived object replacement
Browse files Browse the repository at this point in the history
When an objects overwrites an object in a non-versioned bucket, need
to add special handling to ensure an oplog entry is generated about the
"removal" of object: so that Backbeat can detect it, and notify cold
storage backend.

This was fixed already for putObject in CLDSRV-560, but the MPU and
copyObject cases were not handled.

Issue: CLDSRV-577
  • Loading branch information
francoisferrand committed Nov 12, 2024
1 parent c02566e commit 3ae9e7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/api/apiUtils/object/createAndStoreObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ function createAndStoreObject(bucketName, bucketMD, objectKey, objMD, authInfo,
if (isPutVersion) {
const options = overwritingVersioning(objMD, metadataStoreParams);
return process.nextTick(() => next(null, options, infoArr));
} else if (!bucketMD.isVersioningEnabled() && objMD?.archive?.archiveInfo) {
}
if (!bucketMD.isVersioningEnabled() && objMD?.archive?.archiveInfo) {
// Ensure we trigger a "delete" event in the oplog for the previously archived object
metadataStoreParams.needOplogUpdate = 's3:ReplaceArchivedObject';
}
Expand Down
6 changes: 6 additions & 0 deletions lib/api/completeMultipartUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ function completeMultipartUpload(authInfo, request, log, callback) {
objMD, extraPartLocations, pseudoCipherBundle,
completeObjData, options));
}

if (!destBucket.isVersioningEnabled() && objMD?.archive?.archiveInfo) {
// Ensure we trigger a "delete" event in the oplog for the previously archived object
metaStoreParams.needOplogUpdate = 's3:ReplaceArchivedObject';
}

return versioningPreprocessing(bucketName,
destBucket, objectKey, objMD, log, (err, options) => {
if (err) {
Expand Down
5 changes: 5 additions & 0 deletions lib/api/objectCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,11 @@ function objectCopy(authInfo, request, sourceBucket,
},
function getVersioningInfo(storeMetadataParams, destDataGetInfoArr,
destObjMD, serverSideEncryption, destBucketMD, next) {
if (!destBucketMD.isVersioningEnabled() && destObjMD?.archive?.archiveInfo) {
// Ensure we trigger a "delete" event in the oplog for the previously archived object
// eslint-disable-next-line
storeMetadataParams.needOplogUpdate = 's3:ReplaceArchivedObject';
}
return versioningPreprocessing(destBucketName,
destBucketMD, destObjectKey, destObjMD, log,
(err, options) => {
Expand Down

0 comments on commit 3ae9e7c

Please sign in to comment.