Compare commits

...

1 Commits

Author SHA1 Message Date
williamlardier 9fb6e0ee53
wip 2023-05-24 00:28:31 +02:00
7 changed files with 19 additions and 17 deletions

BIN
cldsrv-10.gzip Normal file

Binary file not shown.

View File

@ -13,12 +13,11 @@ const { maximumMetaHeadersSize,
function checkUserMetadataSize(responseMetadata) { function checkUserMetadataSize(responseMetadata) {
let userMetadataSize = 0; let userMetadataSize = 0;
// collect the user metadata keys from the object metadata // collect the user metadata keys from the object metadata
const userMetadataHeaders = Object.keys(responseMetadata) for (let key in responseMetadata) {
.filter(key => key.startsWith('x-amz-meta-')); if (responseMetadata.hasOwnProperty(key) && key.startsWith('x-amz-meta-')) {
// compute the size of all user metadata key and its value userMetadataSize += key.length + responseMetadata[key].length;
userMetadataHeaders.forEach(header => { }
userMetadataSize += header.length + responseMetadata[header].length; }
});
// check the size computed against the maximum allowed // check the size computed against the maximum allowed
// if the computed size is greater, then remove all the // if the computed size is greater, then remove all the
// user metadata from the response object // user metadata from the response object

View File

@ -197,7 +197,7 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,
// doing 5 requests at a time. note that the data wrapper // doing 5 requests at a time. note that the data wrapper
// will do 5 parallel requests to data backend to delete parts // will do 5 parallel requests to data backend to delete parts
return async.forEachLimit(inPlay, 5, (entry, moveOn) => { return async.forEachLimit(inPlay, Number(process.env.OPTIM_WORKERS) || 25, (entry, moveOn) => {
async.waterfall([ async.waterfall([
callback => { callback => {
let decodedVersionId; let decodedVersionId;
@ -351,6 +351,7 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,
// end of forEach func // end of forEach func
err => { err => {
log.trace('finished deleting objects', { numOfObjectsRemoved }); log.trace('finished deleting objects', { numOfObjectsRemoved });
console.log('end of multi delete object');
return next(err, quietSetting, errorResults, numOfObjectsRemoved, return next(err, quietSetting, errorResults, numOfObjectsRemoved,
successfullyDeleted, totalContentLengthDeleted, bucket); successfullyDeleted, totalContentLengthDeleted, bucket);
}); });

View File

@ -305,17 +305,16 @@ function objectGet(authInfo, request, returnTagCount, log, callback) {
'GET', bucketName, err.code, 'getObject'); 'GET', bucketName, err.code, 'getObject');
return callback(err); return callback(err);
} }
const contentLength = Number.parseInt(responseMetaHeaders['Content-Length'], 10);
pushMetric('getObject', log, { pushMetric('getObject', log, {
authInfo, authInfo,
bucket: bucketName, bucket: bucketName,
keys: [objectKey], keys: [objectKey],
newByteLength: newByteLength: contentLength,
Number.parseInt(responseMetaHeaders['Content-Length'], 10),
versionId: objMD.versionId, versionId: objMD.versionId,
location: objMD.dataStoreName, location: objMD.dataStoreName,
}); });
monitoring.promMetrics('GET', bucketName, '200', 'getObject', monitoring.promMetrics('GET', bucketName, '200', 'getObject', contentLength);
Number.parseInt(responseMetaHeaders['Content-Length'], 10));
return callback(null, dataLocator, responseMetaHeaders, return callback(null, dataLocator, responseMetaHeaders,
byteRange); byteRange);
}); });

View File

@ -18,8 +18,11 @@ function collectResponseHeaders(objectMD, corsHeaders, versioningCfg,
returnTagCount) { returnTagCount) {
// Add user meta headers from objectMD // Add user meta headers from objectMD
let responseMetaHeaders = Object.assign({}, corsHeaders); let responseMetaHeaders = Object.assign({}, corsHeaders);
Object.keys(objectMD).filter(val => (val.startsWith('x-amz-meta-'))) for (let key in objectMD) {
.forEach(id => { responseMetaHeaders[id] = objectMD[id]; }); if (objectMD.hasOwnProperty(key) && key.startsWith('x-amz-meta-')) {
responseMetaHeaders[key] = objectMD[key];
}
}
// Check user metadata size // Check user metadata size
responseMetaHeaders = checkUserMetadataSize(responseMetaHeaders); responseMetaHeaders = checkUserMetadataSize(responseMetaHeaders);

View File

@ -21,7 +21,7 @@
"dependencies": { "dependencies": {
"@azure/storage-blob": "^12.12.0", "@azure/storage-blob": "^12.12.0",
"@hapi/joi": "^17.1.0", "@hapi/joi": "^17.1.0",
"arsenal": "git+https://github.com/scality/arsenal#8.1.98", "arsenal": "git+https://github.com/scality/arsenal#8e259f97ef97d82be00493a36a92a25866e18613",
"async": "~2.5.0", "async": "~2.5.0",
"aws-sdk": "2.905.0", "aws-sdk": "2.905.0",
"bucketclient": "scality/bucketclient#8.1.9", "bucketclient": "scality/bucketclient#8.1.9",

View File

@ -716,9 +716,9 @@ arraybuffer.slice@~0.0.7:
optionalDependencies: optionalDependencies:
ioctl "^2.0.2" ioctl "^2.0.2"
"arsenal@git+https://github.com/scality/arsenal#8.1.98": "arsenal@git+https://github.com/scality/arsenal#8e259f97ef97d82be00493a36a92a25866e18613":
version "8.1.97" version "8.1.96"
resolved "git+https://github.com/scality/arsenal#3f7229eebe378a0f4852d2c25b9ac33c027fa7eb" resolved "git+https://github.com/scality/arsenal#8e259f97ef97d82be00493a36a92a25866e18613"
dependencies: dependencies:
"@azure/identity" "^3.1.1" "@azure/identity" "^3.1.1"
"@azure/storage-blob" "^12.12.0" "@azure/storage-blob" "^12.12.0"