Fix getDiskUsage and add getCollectionStats#2605
Conversation
Hello delthas,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
|
LGTM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.3 #2605 +/- ##
===================================================
- Coverage 73.37% 73.36% -0.01%
===================================================
Files 222 222
Lines 18160 18169 +9
Branches 3761 3784 +23
===================================================
+ Hits 13324 13329 +5
- Misses 4831 4835 +4
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
Jira issue not foundThe Jira issue ARSN-566 was not found. |
|
note: this is an "independent" fix, could be fixed to Arsenal 8.3 if it makes integration easier/simpler... |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
|
LGTM |
SylvainSenechal
left a comment
There was a problem hiding this comment.
Next time try to re add in the PR summary the Issue: ARSN-566, so i can quickly click on it to read the jira ticket, it's also missing in your backbeat pr
Indeed, thanks. |
dbfb436 to
89e678b
Compare
Review by Claude Code |
Review by Claude Code |
Request integration branchesWaiting for integration branch creation to be requested by the user. To request integration branches, please comment on this pull request with the following command: Alternatively, the |
89e678b to
44301ec
Compare
|
44301ec to
4c4eed8
Compare
|
LGTM — clean fix and solid tests. |
getDiskUsage was reading the nonexistent fsFreeSize field from MongoDB's dbStats, always returning 0. Fix it to compute free space as fsTotalSize - fsUsedSize, with validation that both fields are present. Add getCollectionStats method that exposes per-collection stats via the collStats command. This is needed by the lifecycle conductor to check disk space before creating indexes (BB-753). Drop mock-based unit tests in favor of functional tests against a real MongoMemoryReplSet, which would have caught the original fsFreeSize bug. Issue: ARSN-566
4c4eed8 to
e7d02f5
Compare
|
LGTM |
|
/approve |
Integration data createdI have created the integration data for the additional destination branches.
The following branches will NOT be impacted:
You can set option The following options are set: approve |
|
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue ARSN-566. Goodbye delthas. The following options are set: approve |
Summary
getDiskUsage: Was reading the nonexistentfsFreeSizefield from MongoDB'sdbStatscommand, always returning 0 for available/free space. Now correctly computes free space asfsTotalSize - fsUsedSize.getCollectionStats: New method onMongoClientInterfacethat exposes per-collection stats via thecollStatscommand. Returns the raw stats object includingindexSizes(per-index size breakdown) andtotalIndexSize.Context
The lifecycle conductor (BB-753) needs to check available disk space before creating v2 indexes on MongoDB. When the MongoDB PV is nearly full, attempting index creation can fail (ENOSPC) or further pressure the disk. The conductor uses
getDiskUsagefor filesystem free space andgetCollectionStatsto get the_id_index size as an estimate for the cost of creating lifecycle indexes.Design decisions
getDiskUsagekeeps its existing return shape ({ available, free, total }) to avoid breaking the interface contract, just fixes the computation.getCollectionStatspasses stats through directly from MongoDB rather than reshaping — the caller extracts what it needs.db.command({ collStats })instead of the deprecatedcollection.stats()which was removed from the MongoDB Node.js driver type definitions.