diff --git a/CountItems/utils/utils.js b/CountItems/utils/utils.js index e4c24e2a..ed9a5090 100644 --- a/CountItems/utils/utils.js +++ b/CountItems/utils/utils.js @@ -18,6 +18,7 @@ function consolidateDataMetrics(target, source) { _nonCurrentRestored: 0, _nonCurrentRestoring: 0, _inflightsPreScan: 0, + _incompleteMPUParts: 0, }, }); } @@ -32,6 +33,7 @@ function consolidateDataMetrics(target, source) { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }, }); @@ -48,6 +50,7 @@ function consolidateDataMetrics(target, source) { resTarget.usedCapacity._currentRestored += usedCapacity && usedCapacity._currentRestored ? usedCapacity._currentRestored : 0; resTarget.usedCapacity._nonCurrentRestoring += usedCapacity && usedCapacity._nonCurrentRestoring ? usedCapacity._nonCurrentRestoring : 0; resTarget.usedCapacity._nonCurrentRestored += usedCapacity && usedCapacity._nonCurrentRestored ? usedCapacity._nonCurrentRestored : 0; + resTarget.usedCapacity._incompleteMPUParts += usedCapacity && usedCapacity._incompleteMPUParts ? usedCapacity._incompleteMPUParts : 0; resTarget.objectCount.current += objectCount && objectCount.current ? objectCount.current : 0; resTarget.objectCount.nonCurrent += objectCount && objectCount.nonCurrent ? objectCount.nonCurrent : 0; @@ -58,6 +61,7 @@ function consolidateDataMetrics(target, source) { resTarget.objectCount._currentRestored += objectCount && objectCount._currentRestored ? objectCount._currentRestored : 0; resTarget.objectCount._nonCurrentRestoring += objectCount && objectCount._nonCurrentRestoring ? objectCount._nonCurrentRestoring : 0; resTarget.objectCount._nonCurrentRestored += objectCount && objectCount._nonCurrentRestored ? objectCount._nonCurrentRestored : 0; + resTarget.objectCount._incompleteMPUUploads += objectCount && objectCount._incompleteMPUUploads ? objectCount._incompleteMPUUploads : 0; resTarget.usedCapacity._inflightsPreScan += usedCapacity && usedCapacity._inflightsPreScan ? usedCapacity._inflightsPreScan : 0; if (accountOwnerID) { @@ -65,11 +69,13 @@ function consolidateDataMetrics(target, source) { } resTarget.usedCapacity.current += usedCapacity - ? usedCapacity._currentCold + usedCapacity._currentRestored + usedCapacity._currentRestoring : 0; + ? usedCapacity._currentCold + usedCapacity._currentRestored + usedCapacity._currentRestoring + + usedCapacity._incompleteMPUParts : 0; resTarget.usedCapacity.nonCurrent += usedCapacity ? usedCapacity._nonCurrentCold + usedCapacity._nonCurrentRestored + usedCapacity._nonCurrentRestoring : 0; resTarget.objectCount.current += objectCount - ? objectCount._currentCold + objectCount._currentRestored + objectCount._currentRestoring : 0; + ? objectCount._currentCold + objectCount._currentRestored + objectCount._currentRestoring + + objectCount._incompleteMPUUploads : 0; resTarget.objectCount.nonCurrent += objectCount ? objectCount._nonCurrentCold + objectCount._nonCurrentRestored + objectCount._nonCurrentRestoring : 0; diff --git a/package.json b/package.json index 2a727081..37c4f928 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "s3utils", - "version": "1.14.16", + "version": "1.14.17", "engines": { "node": ">= 16" }, diff --git a/tests/functional/utils/S3UtilsMongoClient.js b/tests/functional/utils/S3UtilsMongoClient.js index 1da08337..36d3c19a 100644 --- a/tests/functional/utils/S3UtilsMongoClient.js +++ b/tests/functional/utils/S3UtilsMongoClient.js @@ -153,6 +153,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -163,6 +164,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -176,6 +178,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -186,6 +189,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -203,6 +207,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -213,6 +218,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -228,6 +234,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -238,6 +245,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -311,6 +319,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -321,6 +330,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -334,6 +344,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -344,6 +355,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -361,6 +373,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -371,6 +384,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -386,6 +400,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -396,6 +411,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -464,6 +480,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -474,6 +491,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -487,6 +505,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -497,6 +516,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -514,6 +534,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -524,6 +545,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -539,6 +561,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -549,6 +572,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -625,6 +649,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -635,6 +660,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -648,6 +674,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -658,6 +685,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'completed': { @@ -671,6 +699,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -681,6 +710,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -698,6 +728,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -708,6 +739,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -723,6 +755,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -733,6 +766,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'completed': { @@ -746,6 +780,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -756,6 +791,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -846,6 +882,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -856,6 +893,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -869,6 +907,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -879,6 +918,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'completed': { @@ -892,6 +932,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -902,6 +943,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -919,6 +961,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -929,6 +972,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -944,6 +988,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -954,6 +999,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'completed': { @@ -967,6 +1013,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 10, @@ -977,6 +1024,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1094,6 +1142,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -1104,6 +1153,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -1117,6 +1167,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -1127,6 +1178,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1144,6 +1196,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -1154,6 +1207,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1169,6 +1223,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -1179,6 +1234,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1331,6 +1387,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1341,6 +1398,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1354,6 +1412,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1364,6 +1423,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, }, @@ -1377,6 +1437,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1387,6 +1448,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, }, @@ -1402,6 +1464,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1412,6 +1475,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, }, @@ -1427,6 +1491,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1437,6 +1502,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1450,6 +1516,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 1, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1460,6 +1527,7 @@ describe('S3UtilsMongoClient::getObjectMDStats', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 10, + _incompleteMPUParts: 0, }, }, }, diff --git a/tests/unit/CountItems/CountManager.js b/tests/unit/CountItems/CountManager.js index fd8b774f..47f25419 100644 --- a/tests/unit/CountItems/CountManager.js +++ b/tests/unit/CountItems/CountManager.js @@ -92,6 +92,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -102,6 +103,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -115,6 +117,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -125,6 +128,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -142,6 +146,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -152,6 +157,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -167,6 +173,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -177,6 +184,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -195,6 +203,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -206,6 +215,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -219,6 +229,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -230,6 +241,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -247,6 +259,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -258,6 +271,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -273,6 +287,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -284,6 +299,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -316,6 +332,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -327,6 +344,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -340,6 +358,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -351,6 +370,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -368,6 +388,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -379,6 +400,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -394,6 +416,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -405,6 +428,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -423,6 +447,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -434,6 +459,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -447,6 +473,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -458,6 +485,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -475,6 +503,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -486,6 +515,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -501,6 +531,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -512,6 +543,7 @@ describe('CountItems::CountManager', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, diff --git a/tests/unit/CountItems/utils/utils.js b/tests/unit/CountItems/utils/utils.js index 12a8e913..53b59c31 100644 --- a/tests/unit/CountItems/utils/utils.js +++ b/tests/unit/CountItems/utils/utils.js @@ -12,6 +12,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 0, @@ -23,6 +24,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, }; @@ -37,6 +39,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 10, @@ -48,6 +51,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, }; @@ -62,6 +66,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 20, @@ -73,6 +78,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, }; @@ -87,6 +93,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 20, @@ -98,6 +105,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, }; @@ -112,6 +120,7 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 40, @@ -123,6 +132,61 @@ describe('CountItems::utils::consolidateDataMetrics', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, + }, + }; + + const exampleWithMPU = { + usedCapacity: { + current: 20, + nonCurrent: 20, + _inflightsPreScan: 0, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUParts: 100, + }, + objectCount: { + current: 20, + nonCurrent: 20, + deleteMarker: 20, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUUploads: 10, + }, + }; + + const expectedConsolidatedMPU = { + usedCapacity: { + current: 220, + nonCurrent: 30, + _inflightsPreScan: 0, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUParts: 200, + }, + objectCount: { + current: 40, + nonCurrent: 21, + deleteMarker: 21, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUUploads: 20, }, }; @@ -174,4 +238,35 @@ describe('CountItems::utils::consolidateDataMetrics', () => { const res = consolidateDataMetrics(target, source); expect(res).toEqual(expectedResponseWithInflights); }); + + test('should consolidate MPUs', () => { + const source = { + usedCapacity: { + current: 100, + nonCurrent: 10, + _inflightsPreScan: 0, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUParts: 100, + }, + objectCount: { + current: 10, + nonCurrent: 1, + deleteMarker: 1, + _currentCold: 0, + _nonCurrentCold: 0, + _currentRestored: 0, + _currentRestoring: 0, + _nonCurrentRestored: 0, + _nonCurrentRestoring: 0, + _incompleteMPUUploads: 10, + }, + }; + const res = consolidateDataMetrics(exampleWithMPU, source); + expect(res).toEqual(expectedConsolidatedMPU); + }); }); diff --git a/tests/unit/utils/S3UtilsMongoClient.js b/tests/unit/utils/S3UtilsMongoClient.js index f16449fb..d31f865f 100644 --- a/tests/unit/utils/S3UtilsMongoClient.js +++ b/tests/unit/utils/S3UtilsMongoClient.js @@ -139,6 +139,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 40, @@ -149,6 +150,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -164,6 +166,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -174,6 +177,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, location2: { @@ -187,6 +191,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -197,6 +202,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -212,6 +218,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 40, @@ -222,6 +229,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -235,6 +243,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -245,6 +254,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, location2: { @@ -258,6 +268,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -268,6 +279,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -303,6 +315,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 40, @@ -313,6 +326,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -328,6 +342,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -338,6 +353,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, location2: { @@ -351,6 +367,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -361,6 +378,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -376,6 +394,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 40, @@ -386,6 +405,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { location1: { @@ -399,6 +419,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -409,6 +430,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, location2: { @@ -422,6 +444,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 20, @@ -432,6 +455,7 @@ describe('S3UtilsMongoClient::_handleResults', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -479,7 +503,6 @@ describe('S3UtilsMongoClient::_handleResults', () => { describe('S3UtilsMongoClient::_processEntryData', () => { const testBucketName = 'testBucket'; const objectMdTemp = { - 'last-modified': new Date(), 'replicationInfo': { status: 'PENDING', backends: [], @@ -1175,6 +1198,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1185,6 +1209,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'rep-loc-1': { @@ -1198,6 +1223,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1208,6 +1234,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1221,6 +1248,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1231,6 +1259,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1248,6 +1277,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1258,6 +1288,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1273,6 +1304,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1283,6 +1315,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1296,6 +1329,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1306,6 +1340,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1364,6 +1399,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1374,6 +1410,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'us-east-1': { @@ -1387,6 +1424,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1397,6 +1435,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1414,6 +1453,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1424,6 +1464,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1439,6 +1480,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -1449,6 +1491,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1527,6 +1570,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1537,6 +1581,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'rep-loc-1': { @@ -1550,6 +1595,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1560,6 +1606,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1573,6 +1620,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1583,6 +1631,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1600,6 +1649,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1610,6 +1660,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1625,6 +1676,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1635,6 +1687,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1648,6 +1701,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1658,6 +1712,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1757,6 +1812,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1767,6 +1823,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'rep-loc-1': { @@ -1780,6 +1837,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1790,6 +1848,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1803,6 +1862,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1813,6 +1873,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'cold-location': { @@ -1826,6 +1887,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1836,6 +1898,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1853,6 +1916,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1863,6 +1927,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1878,6 +1943,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1888,6 +1954,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -1901,6 +1968,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 100, @@ -1911,6 +1979,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'cold-location': { @@ -1924,6 +1993,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -1934,6 +2004,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -1991,6 +2062,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2001,6 +2073,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'cold-location': { @@ -2014,6 +2087,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2024,6 +2098,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -2037,6 +2112,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2047,6 +2123,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2064,6 +2141,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2074,6 +2152,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2089,6 +2168,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2099,6 +2179,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'cold-location': { @@ -2112,6 +2193,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 1, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2122,6 +2204,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 100, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2203,6 +2286,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -2213,6 +2297,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, locations: { 'rep-loc-1': { @@ -2226,6 +2311,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2236,6 +2322,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -2249,6 +2336,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -2259,6 +2347,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2277,6 +2366,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -2288,6 +2378,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2303,6 +2394,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 0, @@ -2313,6 +2405,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, 'us-east-1': { @@ -2326,6 +2419,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, }, usedCapacity: { current: 200, @@ -2336,6 +2430,7 @@ describe('S3UtilsMongoClient, tests', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, }, }, @@ -2408,6 +2503,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, _inflightsPreScan: 100, _inflight: 100, }, @@ -2420,6 +2516,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }, }, @@ -2436,6 +2533,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, _inflightsPreScan: 1500, _inflight: 1500, }, @@ -2448,6 +2546,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }, }, @@ -2463,6 +2562,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, _inflight: 0, }, objectCount: { @@ -2474,6 +2574,7 @@ describe('S3UtilsMongoClient, update inflight deltas', () => { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }, }, diff --git a/utils/S3UtilsMongoClient.js b/utils/S3UtilsMongoClient.js index b91e4d01..8b4e37a0 100644 --- a/utils/S3UtilsMongoClient.js +++ b/utils/S3UtilsMongoClient.js @@ -42,6 +42,8 @@ const baseMetricsObject = { versionCountRestored: 0, versionDataRestored: 0, deleteMarkerCountRestored: 0, + mpuUploadCounts: 0, + mpuPartsData: 0, }; class S3UtilsMongoClient extends MongoClientInterface { @@ -159,6 +161,7 @@ class S3UtilsMongoClient extends MongoClientInterface { async getObjectMDStats(bucketName, bucketInfo, isTransient, log, callback) { let cursor; + let cursorMpuBucket; try { const c = this.getCollection(bucketName); cursor = c.find({}, { @@ -193,6 +196,10 @@ class S3UtilsMongoClient extends MongoClientInterface { const usersBucketCreationDatesMap = await this._getUsersBucketCreationDates(log); + const bucketStatus = bucketInfo.getVersioningConfiguration(); + const isVer = (bucketStatus && (bucketStatus.Status === 'Enabled' + || bucketStatus.Status === 'Suspended')); + if (!usersBucketCreationDatesMap) { return callback(errors.InternalError); } @@ -207,153 +214,197 @@ class S3UtilsMongoClient extends MongoClientInterface { let startCursorDate = new Date(); let processed = 0; - await cursor.forEach( - res => { - // Periodically display information about the cursor - // if more than 30s elapsed - const currentDate = Date.now(); - if (currentDate - startCursorDate > 30000) { - startCursorDate = currentDate; - log.info('Processing cursor', { - method: 'getObjectMDStats', - bucketName, - processed, - }); - } - const isObjectCold = this._isObjectCold(res); - const isObjectRestoring = this._isObjectRestoring(res); - const isObjectRestored = this._isObjectRestored(res); - - const { data, error } = this._processEntryData( + const processCursorEntry = (entry, isMPUPart = false, isOverviewKey = false) => { + // Periodically display information about the cursor + // if more than 30s elapsed + const currentDate = Date.now(); + if (currentDate - startCursorDate > 30000) { + startCursorDate = currentDate; + log.info('Processing cursor', { + method: 'getObjectMDStats', bucketName, - bucketInfo, - res, - usersBucketCreationDatesMap[`${res.value['owner-id']}${constants.splitter}${bucketName}`], - isTransient, - locationConfig, - { - isCold: isObjectCold, - isRestoring: isObjectRestoring, - isRestored: isObjectRestored, - }, - ); + processed, + }); + } - if (error) { - log.error('Failed to process entry data', { - method: 'getObjectMDStats', - entry: res, - error, - }); - monitoring.objectsCount.inc({ status: 'error' }); - return; - } + const isObjectCold = this._isObjectCold(entry); + const isObjectRestoring = this._isObjectRestoring(entry); + const isObjectRestored = this._isObjectRestored(entry); - if (!data) { - // Skipping entry, esp. in case of PHD - log.info('Skipping entry', { - method: 'getObjectMDStats', - entry: res, - }); - monitoring.objectsCount.inc({ status: 'skipped' }); - return; - } + const { data, error } = this._processEntryData( + bucketName, + bucketInfo, + entry, + usersBucketCreationDatesMap[`${entry.value['owner-id']}${constants.splitter}${bucketName}`], + isTransient, + locationConfig, + { + isCold: isObjectCold, + isRestoring: isObjectRestoring, + isRestored: isObjectRestored, + }, + ); - let targetCount; - let targetData; - if (res._id.indexOf('\0') !== -1) { - // versioned item - targetCount = 'versionCount'; - targetData = 'versionData'; + if (error) { + log.error('Failed to process entry data', { + method: 'getObjectMDStats', + entry, + error, + }); + monitoring.objectsCount.inc({ status: 'error' }); + return; + } - if (res.value.replicationInfo.backends.length > 0 - && this._isReplicationEntryStalled(res, cmpDate)) { - stalledCount++; - } - } else if (!!res.value.versionId && !res.value.isNull) { - // master version - // includes current objects in versioned bucket and - // objects uploaded before bucket suspended - targetCount = 'masterCount'; - targetData = 'masterData'; - } else { - // null version - // include current objects in nonversioned bucket and - // objects uploaded after bucket suspended - targetCount = 'nullCount'; - targetData = 'nullData'; - } + if (!data) { + // Skipping entry, esp. in case of PHD + log.info('Skipping entry', { + method: 'getObjectMDStats', + entry, + }); + monitoring.objectsCount.inc({ status: 'skipped' }); + return; + } + + let targetCount; + let targetData; + if (entry._id.indexOf('\0') !== -1) { + // versioned item + targetCount = 'versionCount'; + targetData = 'versionData'; - // Dynamically get the metrics based on the object state - if (isObjectCold) { - targetCount += 'Cold'; - targetData += 'Cold'; - } else if (isObjectRestoring) { - targetCount += 'Restoring'; - targetData += 'Restoring'; - } else if (isObjectRestored) { - targetCount += 'Restored'; - targetData += 'Restored'; + if (entry.value.replicationInfo.backends.length > 0 + && this._isReplicationEntryStalled(entry, cmpDate)) { + stalledCount++; } + } else if (!!entry.value.versionId && !entry.value.isNull) { + // master version + // includes current objects in versioned bucket and + // objects uploaded before bucket suspended + targetCount = 'masterCount'; + targetData = 'masterData'; + } else { + // null version + // include current objects in nonversioned bucket and + // objects uploaded after bucket suspended + targetCount = 'nullCount'; + targetData = 'nullData'; + } - Object.keys(data).forEach(metricLevel => { - // metricLevel can only be 'bucket', 'location' or 'account' - if (validStorageMetricLevels.has(metricLevel)) { - Object.keys(data[metricLevel]).forEach(resourceName => { - // resourceName can be the name of bucket, location or account - if (!collRes[metricLevel][resourceName]) { - collRes[metricLevel][resourceName] = { - ...baseMetricsObject, - }; - } - collRes[metricLevel][resourceName][targetData] += data[metricLevel][resourceName]; - collRes[metricLevel][resourceName][targetCount]++; - collRes[metricLevel][resourceName].deleteMarkerCount += res.value.isDeleteMarker ? 1 : 0; - }); - } - }); - Object.keys(data.account).forEach(account => { - if (!collRes.account[account].locations) { - collRes.account[account].locations = {}; - } + // Dynamically get the metrics based on the object state + if (isObjectCold) { + targetCount += 'Cold'; + targetData += 'Cold'; + } else if (isObjectRestoring) { + targetCount += 'Restoring'; + targetData += 'Restoring'; + } else if (isObjectRestored) { + targetCount += 'Restored'; + targetData += 'Restored'; + } + + if (isMPUPart || isOverviewKey) { + targetCount = 'mpuUploadCounts'; + targetData = 'mpuPartsData'; + } - Object.keys(data.location).forEach(location => { - if (!collRes.account[account].locations[location]) { - collRes.account[account].locations[location] = { + Object.keys(data).forEach(metricLevel => { + // metricLevel can only be 'bucket', 'location' or 'account' + if (validStorageMetricLevels.has(metricLevel)) { + Object.keys(data[metricLevel]).forEach(resourceName => { + // resourceName can be the name of bucket, location or account + if (!collRes[metricLevel][resourceName]) { + collRes[metricLevel][resourceName] = { ...baseMetricsObject, }; } - collRes.account[account].locations[location][targetData] += data.location[location]; - collRes.account[account].locations[location][targetCount]++; - collRes.account[account].locations[location].deleteMarkerCount += res.value.isDeleteMarker ? 1 : 0; + collRes[metricLevel][resourceName][targetData] += data[metricLevel][resourceName]; + // Do not count the MPU parts as objects + if (!isMPUPart) { + collRes[metricLevel][resourceName][targetCount]++; + } + collRes[metricLevel][resourceName].deleteMarkerCount += entry.value.isDeleteMarker ? 1 : 0; }); + } + }); + Object.keys(data.account).forEach(account => { + if (!collRes.account[account].locations) { + collRes.account[account].locations = {}; + } + + Object.keys(data.location).forEach(location => { + if (!collRes.account[account].locations[location]) { + collRes.account[account].locations[location] = { + ...baseMetricsObject, + }; + } + collRes.account[account].locations[location][targetData] += data.location[location]; + if (!isMPUPart) { + collRes.account[account].locations[location][targetCount]++; + } + collRes.account[account].locations[location].deleteMarkerCount += entry.value.isDeleteMarker ? 1 : 0; }); - // one bucket has only one account - [accountBucket] = Object.keys(collRes.account); - monitoring.objectsCount.inc({ status: 'success' }); - processed++; - }, - err => { - if (err) { - log.error('Error when processing mongo entries', { - method: 'getObjectMDStats', - errDetails: { ...err }, - errorString: err.toString(), - }); - return callback(err); + }); + // one bucket has only one account + [accountBucket] = Object.keys(collRes.account); + monitoring.objectsCount.inc({ status: 'success' }); + processed++; + }; + + await cursor.forEach( + res => processCursorEntry(res), + ); + + const mpuBucket = `${constants.mpuBucketPrefix}${bucketName}`; + const collectionMpu = this.getCollection(mpuBucket); + cursorMpuBucket = collectionMpu.find({}); + + // MPU entries from the mpu shadow bucket must be considered + // as part of the current metrics. + await cursorMpuBucket.forEach( + res => { + if (res._id.startsWith(`overview${constants.splitter}`)) { + // For overview keys, only consider the number of object + return processCursorEntry({ + _id: res._id, + value: { + 'replicationInfo': { + status: '', + backends: [], + }, + 'dataStoreName': res.value.dataStoreName, + 'content-length': 0, + 'versionId': null, + 'owner-id': res.value['owner-id'], + 'isDeleteMarker': false, + 'isNull': false, + 'archive': null, + 'x-amz-storage-class': 'STANDARD', + 'isPHD': false, + }, + }, false, true); } - const bucketStatus = bucketInfo.getVersioningConfiguration(); - const isVer = (bucketStatus && (bucketStatus.Status === 'Enabled' - || bucketStatus.Status === 'Suspended')); - const retResult = this._handleResults(collRes, isVer); - retResult.stalled = stalledCount; - return callback(null, retResult); + return processCursorEntry({ + _id: res._id, + value: { + 'replicationInfo': { + status: '', + backends: [], + }, + 'dataStoreName': res.value.partLocations[0].dataStoreName, + 'content-length': res.value['content-length'], + 'versionId': null, + 'owner-id': res.value['owner-id'], + 'isDeleteMarker': false, + 'isNull': false, + 'archive': null, + 'x-amz-storage-class': 'STANDARD', + 'isPHD': false, + }, + }, true); }, ); - const bucketStatus = bucketInfo.getVersioningConfiguration(); - const isVer = (bucketStatus && (bucketStatus.Status === 'Enabled' - || bucketStatus.Status === 'Suspended')); const retResult = this._handleResults(collRes, isVer); retResult.stalled = stalledCount; @@ -516,6 +567,7 @@ class S3UtilsMongoClient extends MongoClientInterface { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }, objectCount: { current: 0, @@ -526,6 +578,7 @@ class S3UtilsMongoClient extends MongoClientInterface { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }, }; @@ -559,16 +612,20 @@ class S3UtilsMongoClient extends MongoClientInterface { versionCountRestored = 0, versionDataRestored = 0, deleteMarkerCountRestored = 0, + mpuUploadCounts = 0, + mpuPartsData = 0, } = res[metricLevel][resourceName]; dataMetrics[metricLevel][resourceName].usedCapacity.current += nullData + masterData; dataMetrics[metricLevel][resourceName].usedCapacity._currentCold += nullDataCold + masterDataCold; dataMetrics[metricLevel][resourceName].usedCapacity._currentRestoring += nullDataRestoring + masterDataRestoring; dataMetrics[metricLevel][resourceName].usedCapacity._currentRestored += nullDataRestored + masterDataRestored; + dataMetrics[metricLevel][resourceName].usedCapacity._incompleteMPUParts += mpuPartsData; dataMetrics[metricLevel][resourceName].objectCount.current += nullCount + masterCount; dataMetrics[metricLevel][resourceName].objectCount._currentCold += nullCountCold + masterCountCold; dataMetrics[metricLevel][resourceName].objectCount._currentRestoring += nullCountRestoring + masterCountRestoring; dataMetrics[metricLevel][resourceName].objectCount._currentRestored += nullCountRestored + masterCountRestored; + dataMetrics[metricLevel][resourceName].objectCount._incompleteMPUUploads += mpuUploadCounts; if (isVersioned) { dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent @@ -655,6 +712,7 @@ class S3UtilsMongoClient extends MongoClientInterface { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUParts: 0, }; } if (!accountLocation.objectCount) { @@ -667,6 +725,7 @@ class S3UtilsMongoClient extends MongoClientInterface { _currentRestoring: 0, _nonCurrentRestored: 0, _nonCurrentRestoring: 0, + _incompleteMPUUploads: 0, deleteMarker: 0, }; } @@ -678,6 +737,7 @@ class S3UtilsMongoClient extends MongoClientInterface { accountLocation.usedCapacity._nonCurrentRestoring += dataMetrics.location[location].usedCapacity._nonCurrentRestoring; accountLocation.usedCapacity._currentRestored += dataMetrics.location[location].usedCapacity._currentRestored; accountLocation.usedCapacity._nonCurrentRestored += dataMetrics.location[location].usedCapacity._nonCurrentRestored; + accountLocation.usedCapacity._incompleteMPUParts += dataMetrics.location[location].usedCapacity._incompleteMPUParts; accountLocation.objectCount.current += dataMetrics.location[location].objectCount.current; accountLocation.objectCount.nonCurrent += dataMetrics.location[location].objectCount.nonCurrent; @@ -687,6 +747,7 @@ class S3UtilsMongoClient extends MongoClientInterface { accountLocation.objectCount._nonCurrentRestoring += dataMetrics.location[location].objectCount._nonCurrentRestoring; accountLocation.objectCount._currentRestored += dataMetrics.location[location].objectCount._currentRestored; accountLocation.objectCount._nonCurrentRestored += dataMetrics.location[location].objectCount._nonCurrentRestored; + accountLocation.objectCount._incompleteMPUUploads += dataMetrics.location[location].objectCount._incompleteMPUUploads; accountLocation.objectCount.deleteMarker += dataMetrics.location[location].objectCount.deleteMarker; });