S3UTILS-226 MPU orphan cleanup script#380
S3UTILS-226 MPU orphan cleanup script#380jonathan-gramain wants to merge 2 commits intodevelopment/1.16from
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/1.16 #380 +/- ##
====================================================
+ Coverage 44.59% 45.23% +0.64%
====================================================
Files 84 85 +1
Lines 5819 6046 +227
Branches 1237 1282 +45
====================================================
+ Hits 2595 2735 +140
- Misses 3179 3265 +86
- Partials 45 46 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8ab54e6 to
07cb65f
Compare
Implement cleanupMpuOrphans.js to delete orphaned parts and sproxyd keys. Orphaned parts are part metadata which do not correspond to an overview key with the same upload ID. Sproxyd keys are only removed if no completed MPU object has a matching upload ID in the same bucket.
3386bfa to
e3f5b12
Compare
Hello jonathan-gramain,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
|
ping |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
Add context of the script, its principle, and the main logs output
0458ae8 to
bb4d32c
Compare
scality-fno
left a comment
There was a problem hiding this comment.
Strictly from a doc perspective.
I'm ok with the documentation. Some clarification could be beneficial. Not a blocker, though.
| log.info('starting discovery phase: scanning MPU shadow bucket', { bucket, shadowBucket }); | ||
|
|
||
| status.bucket = bucket; | ||
| status.phase = 'discovery'; | ||
| status.orphanedUploadIds = 0; | ||
| status.versionsScanned = 0; | ||
| status.orphanPartsDeleted = 0; | ||
| status.sproxydKeysDeleted = 0; | ||
|
|
||
| const orphanMap = await buildOrphanMap( | ||
| BUCKETD_HOSTPORT, | ||
| shadowBucket, | ||
| { pageSize: LISTING_PAGE_SIZE, retry: RETRY_PARAMS }, | ||
| ); | ||
| const orphanCount = Object.keys(orphanMap).length; | ||
| status.orphanedUploadIds = orphanCount; | ||
| logProgress('discovery phase complete'); | ||
| if (orphanCount === 0) { | ||
| return; | ||
| } | ||
|
|
||
| for (const [uploadId, info] of Object.entries(orphanMap)) { | ||
| log.info('orphaned MPU found', { |
There was a problem hiding this comment.
Don't know if the Usage section is meant to describe the exact sequence of the log messages, but if it is, the code contradicts it: the "orphaned MPU found" message comes last. Is this intentional?
| const VERBOSE = process.env.VERBOSE === '1'; | ||
| const TRACE = process.env.TRACE === '1'; | ||
|
|
||
| let logLevel; | ||
| if (TRACE) { | ||
| logLevel = 'trace'; | ||
| } else if (VERBOSE) { | ||
| logLevel = 'debug'; | ||
| } else { | ||
| logLevel = 'info'; | ||
| } |
There was a problem hiding this comment.
nitpick: (Claude) Those three entries (deleted orphaned sproxyd key, not deleting sproxyd key used by completed MPU, deleted orphaned part metadata) are logged at debug level. They show up when either VERBOSE=1 or TRACE=1. Labelling them [VERBOSE ONLY] could confuse someone who set TRACE=1 and wonders why they're seeing those lines. [VERBOSE or TRACE] or just [requires VERBOSE=1 or TRACE=1] would be more accurate.
| - Cleanup phase: scans the bucket with a versioned listing, | ||
| matches any completed MPU with their orphaned counterpart to | ||
| detect used sproxyd keys, and only deletes the unused ones along | ||
| with the orphaned metadata |
There was a problem hiding this comment.
Doc clarity: Claude: That's accurate for the case where the orphaned upload ID matches a completed object. But the code also handles the complementary case: orphaned entries that don't match any completed version in the bucket are deleted entirely (all their sproxyd keys, unconditionally).
| - Cleanup phase: scans the bucket with a versioned listing, | |
| matches any completed MPU with their orphaned counterpart to | |
| detect used sproxyd keys, and only deletes the unused ones along | |
| with the orphaned metadata | |
| - Cleanup phase: scans the bucket with a versioned listing, | |
| matches any completed MPU with their orphaned counterpart to | |
| detect used sproxyd keys, and only deletes the unused ones along | |
| with the orphaned metadata. Any orphaned upload IDs that were not | |
| matched to any completed object version are also deleted | |
| unconditionally. |
Implement cleanupMpuOrphans.js to delete orphaned parts and sproxyd keys.
Orphaned parts are part metadata which do not correspond to an overview key with the same upload ID.
Sproxyd keys are only removed if no completed MPU object has a matching upload ID in the same bucket.