Feat/quota config: Admins can now configure quotas#305
Open
St4NNi wants to merge 35 commits into
Open
Conversation
…ta from reducer state
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.
This PR extends the usage accounting feature: quota configuration as realm-replicated admin policy with admin endpoints, distribution of per-node usage counters over the sync layer with realm-wide aggregation, and a hard per-group byte quota gate on the S3 write paths. Includes the delta-test suite required by the issue.
Changes
max_devices_per_usertoQuotaConfigas stored configuration for the device cap.RealmConfigQuotaSetadmin document operation with reducer and overlay materialization so quota changes replicate, and fixes peers resetting quota to defaults when rebuilding realm config from reducer state.SetRealmQuotaOperationvalidating the warn threshold (1-100), global and per-override grace factors (>= 100), and duplicate group or user overrides.PUT /api/v1/info/realm/quota(realm admin on a management node, replace semantics) and exposes quota inGET /api/v1/info/realm.NodeUsageSnapshotdocuments in a newusage_node_statskeyspace, keyed per node for global counters and group-first for per-group counters.DocumentSyncTarget::NodeUsagereplicating snapshots over one shared realm-scoped topic.GET /api/v1/info/usageandGET /api/v1/groups/{id}/usagewith realm-wide totals; the realm section requires authentication while node-local fields keep their existing behavior.QuotaGateenforcing per-group byte quotas inside the object put and multipart completion write transactions, summing live local counters and remote group snapshots.QuotaExceeded; deletes, aborts, and zero-length writes are never gated.GitHub Issues
RealmNodecarries no ownership, so enforcement is blocked on [feat] User node kind and device enrollment #271. The config field is stored for it.Notes
usage_node_statsand keep counting toward realm totals; cleanup belongs to dead-node handling in [feat] Balancer and dead node handling #265.