Skip to content

Commit

Permalink
Support counting mpus in count items
Browse files Browse the repository at this point in the history
- The MPU parts size are part of the current size of the bucket
- Only the count of overview keys are part of the object count
- The metrics are detailed in a field
- The getObjectMDStats function is updated: the logic to process
  each cursor's entry is shared, and mpu entries are processed
  in the same way as the regular objects, with some specifics.

Issue: S3UTILS-186
  • Loading branch information
williamlardier committed Dec 23, 2024
1 parent 1be6653 commit a2808bc
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 119 deletions.
10 changes: 8 additions & 2 deletions CountItems/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function consolidateDataMetrics(target, source) {
_nonCurrentRestored: 0,
_nonCurrentRestoring: 0,
_inflightsPreScan: 0,
_incompleteMPUParts: 0,
},
});
}
Expand All @@ -32,6 +33,7 @@ function consolidateDataMetrics(target, source) {
_currentRestoring: 0,
_nonCurrentRestored: 0,
_nonCurrentRestoring: 0,
_incompleteMPUParts: 0,
deleteMarker: 0,
},
});
Expand All @@ -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;
Expand All @@ -58,18 +61,21 @@ 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._incompleteMPUParts += objectCount && objectCount._incompleteMPUParts ? objectCount._incompleteMPUParts : 0;

resTarget.usedCapacity._inflightsPreScan += usedCapacity && usedCapacity._inflightsPreScan ? usedCapacity._inflightsPreScan : 0;
if (accountOwnerID) {
resTarget.accountOwnerID = accountOwnerID;
}

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._incompleteMPUParts : 0;
resTarget.objectCount.nonCurrent += objectCount
? objectCount._nonCurrentCold + objectCount._nonCurrentRestored + objectCount._nonCurrentRestoring : 0;

Expand Down
Loading

0 comments on commit a2808bc

Please sign in to comment.