Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jan 16, 2025
1 parent 917dd1a commit a2eb325
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions utils/S3UtilsMongoClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,14 @@ class S3UtilsMongoClient extends MongoClientInterface {
}

_handleResults(res, isVersioned) {
let totalNonCurrentCount = 0;
let totalCurrentCount = 0;
let totalNonCurrentColdCount = 0;
let totalCurrentColdCount = 0;
let totalRestoringCount = 0;
let totalRestoredCount = 0;
let totalVersionRestoringCount = 0;
let totalVerionsRestoredCount = 0;
let totalNonCurrentCount = BigInt(0);
let totalCurrentCount = BigInt(0);
let totalNonCurrentColdCount = BigInt(0);
let totalCurrentColdCount = BigInt(0);
let totalRestoringCount = BigInt(0);
let totalRestoredCount = BigInt(0);
let totalVersionRestoringCount = BigInt(0);
let totalVerionsRestoredCount = BigInt(0);

const totalBytes = { curr: 0, prev: 0 };
const locationBytes = {};
Expand Down Expand Up @@ -616,50 +616,50 @@ class S3UtilsMongoClient extends MongoClientInterface {
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;
dataMetrics[metricLevel][resourceName].usedCapacity.current += BigInt(nullData) + BigInt(masterData);

Check failure on line 619 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].usedCapacity._currentCold += BigInt(nullDataCold) + BigInt(masterDataCold);

Check failure on line 620 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'

Check failure on line 620 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].usedCapacity._currentRestoring += BigInt(nullDataRestoring) + BigInt(masterDataRestoring);

Check failure on line 621 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'

Check failure on line 621 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].usedCapacity._currentRestored += BigInt(nullDataRestored) + BigInt(masterDataRestored);

Check failure on line 622 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'

Check failure on line 622 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].usedCapacity._incompleteMPUParts += BigInt(mpuPartsData);

Check failure on line 623 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].objectCount.current += BigInt(nullCount) + BigInt(masterCount);

Check failure on line 624 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'

Check failure on line 624 in utils/S3UtilsMongoClient.js

View workflow job for this annotation

GitHub Actions / tests

Multiple spaces found before 'BigInt'
dataMetrics[metricLevel][resourceName].objectCount._currentCold += BigInt(nullCountCold) + BigInt(masterCountCold);
dataMetrics[metricLevel][resourceName].objectCount._currentRestoring += BigInt(nullCountRestoring) + BigInt(masterCountRestoring);
dataMetrics[metricLevel][resourceName].objectCount._currentRestored += BigInt(nullCountRestored) + BigInt(masterCountRestored);
dataMetrics[metricLevel][resourceName].objectCount._incompleteMPUUploads += BigInt(mpuUploadCounts);

if (isVersioned) {
dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent
+= versionData - masterData; // masterData is duplicated in versionedData
+= BigInt(versionData) - BigInt(masterData); // masterData is duplicated in versionedData
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentCold
+= versionDataCold - masterDataCold;
+= BigInt(versionDataCold) - BigInt(masterDataCold);
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestoring
+= versionDataRestoring - masterDataRestoring;
+= BigInt(versionDataRestoring) - BigInt(masterDataRestoring);
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestored
+= versionDataRestored - masterDataRestored;
+= BigInt(versionDataRestored) - BigInt(masterDataRestored);

dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity.nonCurrent, 0);
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentCold = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentCold, 0);
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestoring = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestoring, 0);
dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestored = Math.max(dataMetrics[metricLevel][resourceName].usedCapacity._nonCurrentRestored, 0);

dataMetrics[metricLevel][resourceName].objectCount.nonCurrent
+= versionCount - masterCount - deleteMarkerCount;
+= BigInt(versionCount) - BigInt(masterCount) - BigInt(deleteMarkerCount);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentCold
+= versionCountCold - masterCountCold;
+= BigInt(versionCountCold) - BigInt(masterCountCold);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestoring
+= versionCountRestoring - masterCountRestoring;
+= BigInt(versionCountRestoring) - BigInt(masterCountRestoring);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestored
+= versionCountRestored - masterCountRestored;
+= BigInt(versionCountRestored) - BigInt(masterCountRestored);

dataMetrics[metricLevel][resourceName].objectCount.nonCurrent = Math.max(dataMetrics[metricLevel][resourceName].objectCount.nonCurrent, 0);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentCold = Math.max(dataMetrics[metricLevel][resourceName].objectCount._nonCurrentCold, 0);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestoring = Math.max(dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestoring, 0);
dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestored = Math.max(dataMetrics[metricLevel][resourceName].objectCount._nonCurrentRestored, 0);

dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCount;
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCountCold;
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCountRestoring;
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += deleteMarkerCountRestored;
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += BigInt(deleteMarkerCount);
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += BigInt(deleteMarkerCountCold);
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += BigInt(deleteMarkerCountRestoring);
dataMetrics[metricLevel][resourceName].objectCount.deleteMarker += BigInt(deleteMarkerCountRestored);
}

if (metricLevel === 'location') { // calculate usedCapacity metrics at global and location level
Expand All @@ -679,11 +679,11 @@ class S3UtilsMongoClient extends MongoClientInterface {
}
}
if (metricLevel === 'bucket') { // count objects up of all buckets
totalCurrentCount += (masterCount + nullCount);
totalNonCurrentCount += isVersioned ? (versionCount - masterCount - deleteMarkerCount) : 0;
totalCurrentCount += BigInt(masterCount + nullCount);
totalNonCurrentCount += isVersioned ? BigInt(versionCount - masterCount - deleteMarkerCount) : BigInt(0);
totalCurrentColdCount += (masterCountCold + nullCountCold);
totalNonCurrentColdCount += isVersioned ? (versionCountCold - masterCountCold) : 0;
totalRestoringCount += (masterCountRestoring + nullCountRestoring);
totalNonCurrentColdCount += isVersioned ? BigInt(versionCountCold - masterCountCold) : BigInt(0);
totalRestoringCount += BigInt(masterCountRestoring + nullCountRestoring);
totalRestoredCount += (masterCountRestored + nullCountRestored);
totalVersionRestoringCount += isVersioned ? (versionCountRestoring - masterCountRestoring) : 0;
totalVerionsRestoredCount += isVersioned ? (versionCountRestored - masterCountRestored) : 0;
Expand Down

0 comments on commit a2eb325

Please sign in to comment.