Compare commits

...

2 Commits

8 changed files with 20 additions and 19 deletions

@ -1 +1 @@
Subproject commit 3370c44161946c082fef659469f01a7a29d151eb
Subproject commit 308492308f2cc286fcb6ea1c65927453d531601e

View File

@ -121,7 +121,7 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
}
// The locations were sent to metadata as an array
// under partLocations. Pull the partLocations.
const locations = storedParts.flatMap(item => item.value.partLocations);
const locations = storedParts.flatMap(item => item.value.location||item.value.partLocations);
if (locations.length === 0) {
return next(null, mpuBucket, storedParts, destBucket);
}

View File

@ -314,7 +314,7 @@ function completeMultipartUpload(authInfo, request, log, callback) {
extraPartLocations, completeObjData, totalMPUSize, next) {
const metaHeaders = {};
const keysNotNeeded =
['initiator', 'partLocations', 'key',
['initiator', 'location', 'partLocations', 'key',
'initiated', 'uploadId', 'content-type', 'expires',
'eventualStorageBucket', 'dataStoreName'];
const metadataKeysToPull =

View File

@ -318,7 +318,7 @@ function objectPutCopyPart(authInfo, request, sourceBucket,
let oldLocations;
let prevObjectSize = null;
if (result) {
oldLocations = result.partLocations;
oldLocations = result.location||result.partLocations;
prevObjectSize = result['content-length'];
// Pull locations to clean up any potential orphans
// in data if object put is an overwrite of

View File

@ -264,8 +264,8 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
// Pull locations to clean up any potential orphans in
// data if object put is an overwrite of a pre-existing
// object with the same key and part number.
oldLocations = Array.isArray(res.partLocations) ?
res.partLocations : [res.partLocations];
oldLocations = Array.isArray(res.location||res.partLocations) ?
(res.location||res.partLocations) : [(res.location||res.partLocations)];
}
return next(null, destinationBucket,
objectLocationConstraint, cipherBundle,
@ -321,9 +321,9 @@ function objectPutPart(authInfo, request, streamingV4Params, log,
partLocations[0].sseCipheredDataKey = cipheredDataKey;
}
const omVal = {
// back to Version 3 since number-subparts is not needed
'md-model-version': 3,
partLocations,
// Version 6 changes 'partLocations' to 'location'
'md-model-version': 6,
'location': partLocations,
'key': partKey,
'last-modified': new Date().toJSON(),
'content-md5': hexDigest,

View File

@ -772,10 +772,9 @@ const services = {
assert.strictEqual(typeof splitter, 'string');
const partKey = `${uploadId}${splitter}${partNumber}`;
const omVal = {
// Version 3 changes the format of partLocations
// from an object to an array
'md-model-version': 3,
partLocations,
// Version 6 changes 'partLocations' to 'location'
'md-model-version': 6,
'location': partLocations,
'key': partKey,
'last-modified': dateModified,
'content-md5': contentMD5,
@ -891,6 +890,7 @@ const services = {
marker: undefined,
delimiter: undefined,
maxKeys: 10000,
withLocation: true,
};
metadata.listObject(mpuBucketName, searchArgs, log, cb);
},
@ -906,6 +906,7 @@ const services = {
marker: `${uploadId}${params.splitter}${paddedPartNumber}`,
delimiter: undefined,
maxKeys: maxParts,
withLocation: true,
};
metadata.listObject(mpuBucketName, searchArgs, log, cb);
},

View File

@ -71,35 +71,35 @@ describe('List Parts API', () => {
'last-modified': '2015-11-30T22:41:18.658Z',
'content-md5': 'f3a9fb2071d3503b703938a74eb99846',
'content-length': '6000000',
'partLocations': ['068db6a6745a79d54c1b29ff99f9f131'],
'location': ['068db6a6745a79d54c1b29ff99f9f131'],
});
inMemMetadata.keyMaps.get(mpuBucket).set(partTwoKey, {
'key': partTwoKey,
'last-modified': '2015-11-30T22:41:40.207Z',
'content-md5': 'f3a9fb2071d3503b703938a74eb99846',
'content-length': '6000000',
'partLocations': ['ff22f316b16956ff5118c93abce7d62d'],
'location': ['ff22f316b16956ff5118c93abce7d62d'],
});
inMemMetadata.keyMaps.get(mpuBucket).set(partThreeKey, {
'key': partThreeKey,
'last-modified': '2015-11-30T22:41:52.102Z',
'content-md5': 'f3a9fb2071d3503b703938a74eb99846',
'content-length': '6000000',
'partLocations': ['dea282f70edb6fc5f9433cd6f525d4a6'],
'location': ['dea282f70edb6fc5f9433cd6f525d4a6'],
});
inMemMetadata.keyMaps.get(mpuBucket).set(partFourKey, {
'key': partFourKey,
'last-modified': '2015-11-30T22:42:03.493Z',
'content-md5': 'f3a9fb2071d3503b703938a74eb99846',
'content-length': '6000000',
'partLocations': ['afe24bc40153982e1f7f28066f7af6a4'],
'location': ['afe24bc40153982e1f7f28066f7af6a4'],
});
inMemMetadata.keyMaps.get(mpuBucket).set(partFiveKey, {
'key': partFiveKey,
'last-modified': '2015-11-30T22:42:22.876Z',
'content-md5': '555e4cd2f9eff38109d7a3ab13995a32',
'content-length': '18',
'partLocations': ['85bc16f5769687070fb13cfe66b5e41f'],
'location': ['85bc16f5769687070fb13cfe66b5e41f'],
});
done();
});

View File

@ -159,7 +159,7 @@ function putMPU(key, body, cb) {
const calculatedHash = md5Hash.digest('hex');
const partKey = `${uploadId}${constants.splitter}00001`;
const obj = {
partLocations: [{
location: [{
key: 1,
dataStoreName: 'scality-internal-mem',
dataStoreETag: `1:${calculatedHash}`,