Skip to content

Commit

Permalink
Use underlying datastore versionId in OOB buckets
Browse files Browse the repository at this point in the history
When writing to OOB bucket/location, use the versionId of the ingested
location (i.e. the dataStore versionId) as the versionId of the object,
like what is done by OOB/ingestion.

This is needed to ensure the object can consistently be accessed from
either Zenko or the data location, with the same versionId; and prevents
the creation of another revision of the
object (basically duplicating it) when the object is ingested.

Issue: CLDSRV-563
  • Loading branch information
francoisferrand committed Oct 4, 2024
1 parent ddf0197 commit e2cbb04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/api/apiUtils/object/createAndStoreObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,14 @@ function createAndStoreObject(bucketName, bucketMD, objectKey, objMD, authInfo,
});
},
function storeMDAndDeleteData(options, infoArr, next) {
metadataStoreParams.versionId = options.versionId;
if (location === bucketMD.getLocationConstraint() && bucketMD.isIngestionBucket()) {
// If the object is being written to the "ingested" storage location, keep the same
// versionId for consistency and to avoid creating an extra version when it gets
// ingested
metadataStoreParams.versionId = infoArr[0].dataStoreVersionId;
} else {
metadataStoreParams.versionId = options.versionId;
}
metadataStoreParams.versioning = options.versioning;
metadataStoreParams.isNull = options.isNull;
metadataStoreParams.deleteNullKey = options.deleteNullKey;
Expand Down
11 changes: 9 additions & 2 deletions lib/api/completeMultipartUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,15 @@ function completeMultipartUpload(authInfo, request, log, callback) {
extraPartLocations, pseudoCipherBundle,
completeObjData, options, next) {
const dataToDelete = options.dataToDelete;
/* eslint-disable no-param-reassign */
metaStoreParams.versionId = options.versionId;
const location = dataLocations[0].dataStoreName;
if (location === destinationBucket.getLocationConstraint() && destinationBucket.isIngestionBucket()) {
// If the object is being written to the "ingested" storage location, keep the same
// versionId for consistency and to avoid creating an extra version when it gets
// ingested
metaStoreParams.versionId = dataLocations[0].dataStoreVersionId;

Check warning on line 403 in lib/api/completeMultipartUpload.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Assignment to property of function parameter 'metaStoreParams'
} else {
metaStoreParams.versionId = options.versionId;

Check warning on line 405 in lib/api/completeMultipartUpload.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Assignment to property of function parameter 'metaStoreParams'
}
metaStoreParams.versioning = options.versioning;

Check warning on line 407 in lib/api/completeMultipartUpload.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Assignment to property of function parameter 'metaStoreParams'
metaStoreParams.isNull = options.isNull;

Check warning on line 408 in lib/api/completeMultipartUpload.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Assignment to property of function parameter 'metaStoreParams'
metaStoreParams.deleteNullKey = options.deleteNullKey;

Check warning on line 409 in lib/api/completeMultipartUpload.js

View workflow job for this annotation

GitHub Actions / linting-coverage

Assignment to property of function parameter 'metaStoreParams'
Expand Down

0 comments on commit e2cbb04

Please sign in to comment.