Add initializeBucketCapacity to seed empty-bucket metrics#2666
Open
delthas wants to merge 2 commits into
Open
Conversation
Contributor
Hello delthas,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Contributor
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development/8.5 #2666 +/- ##
================================================
Coverage 74.70% 74.70%
================================================
Files 229 229
Lines 18682 18698 +16
Branches 3876 3909 +33
================================================
+ Hits 13956 13969 +13
- Misses 4721 4724 +3
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
454e618 to
05db0fa
Compare
8406297 to
7f70f0e
Compare
7f70f0e to
45c987c
Compare
Isolates prettier reformatting of files that were already prettier-dirty on development/8.5, so the functional change commit that follows stays prettier-clean. Issue: ARSN-610
45c987c to
43a1d05
Compare
maeldonn
reviewed
Jul 8, 2026
SylvainSenechal
approved these changes
Jul 8, 2026
Add a MongoClientInterface method that idempotently inserts a zero-value bucket capacity document into __infostore when none exists (upsert with $setOnInsert, so an existing count-items document with real values is never overwritten). Exposed through MetadataWrapper (no-op for non-mongodb backends). This lets CloudServer seed a metric document at bucket creation (or when a quota is enabled on an empty bucket) so bucket quota checks are served before the periodic count-items job runs. Issue: ARSN-610
43a1d05 to
4fcedbc
Compare
maeldonn
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Bucket quota metrics live in the
__infostorecollection, keyedbucket_<name>_<creationTimestamp>, and are written today only by the s3utilscount-itemscron. A freshly created bucket — or a quota enabled on an empty bucket — has no metric document until the next cron run (up to 24h), so CloudServer's bucket-quota check finds nothing in Scuba and fails open (ARTESCA-17063).MongoClientInterfacealready touches__infostoreinternally (writeUUIDIfNotExists), so this is a natural home for the write.Change
MongoClientInterface.initializeBucketCapacity(bucketName, creationDate, log, cb)— idempotently inserts a zero-value bucket metric document viaupdateOne({_id}, {$setOnInsert: zeroDoc}, {upsert: true}). An existing document (e.g. one written by count-items with real values) is never overwritten._id=bucket_<name>_<new Date(creationDate).getTime()>.measuredOnplus all-zerousedCapacityandobjectCount, built from the module-levelemptyBucketCapacityMetricsconstant.MetadataWrapperwith a capability guard (no-op for non-mongodb backends, matching the existinggetUUID/countItemspattern).The consumer is CloudServer (CLDSRV-949, scality/cloudserver#6221), which calls this on
createBucketand onbucketUpdateQuotaof a verifiably-empty bucket.Tests
Unit tests (
MongoClientInterface.spec.js, realmongodb-memory-server): inserts a zero document and reads it back; confirms an existing document is not overwritten (idempotent); returnsInternalErroron update failure.Issue: ARSN-610