hongzhi-gao opened a new pull request, #18202:
URL: https://github.com/apache/iotdb/pull/18202

   ## Description
   
   Add a unified **user-level resource quota** framework so multi-tenant 
workloads can set per-user CPU / memory / temp-disk / disk-IO limits with **min 
(guarantee) + max (cap)**, while staying compatible with existing `THROTTLE 
QUOTA`.
   
   ### SQL & model
   - New SQL: `SET / SHOW / DELETE USER QUOTA`
   - Resources: `CPU`, `MEMORY`, `TEMP_DISK` (capacity, Byte), `DISK_IO` (rate, 
reuse throttle)
   - Read/write dimensions (`read_*` / `write_*`); keep `SET/SHOW THROTTLE 
QUOTA` and map `cpu`/`mem` → `read_cpu_max` / `read_memory_max`
   - Keep config key `quota_enable` (enabled semantics; compatible with 
THROTTLE/SPACE)
   
   ### Runtime enforcement (DataNode-local)
   - Unified `UserResourceQuotaManager.acquire/release` on query 
(`DriverScheduler`) and write paths
   - Capacity scheduling: user max → node capacity → **minGap** (prefer users 
below min when contended)
   - Unconfigured / unlimited users still join node capacity + minGap 
(unlimited ≠ skip scheduling)
   - Lowering max does **not** kill in-flight usage; new acquires are rejected 
until Used ≤ new max
   - `DELETE USER QUOTA` clears config only and keeps in-flight `inUse` until 
tokens release
   - Acquire reject logs concrete reason (user max / node capacity / minGap) 
with user, op, resource
   
   ### Cluster SHOW & defaults
   - `SHOW USER QUOTA`: NodeID = all **Running** DataNodes; DN reports inUse 
via heartbeat; CN aggregates; lost nodes omitted
   - `dn_quota_temp_disk_bytes` default = `min(100GiB, 
ΣdataDirs.totalSpace/10)` at startup; explicit config overrides
   - Quota push: current async + retry; design targets metadata lease / 
`ClusterCachePropagator` when available
   
   ### Tests
   - UT: limiter (max/minGap/unlimited/lower-max/clear-keeps-inUse/reject 
reasons), SHOW multi-DN expand, parse smoke, plan SerDe
   - IT: `IoTDBUserResourceQuotaIT` (SET/SHOW/DELETE, throttle mapping, lower 
max, NodeID)
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
       - [x] concurrent read
       - [x] concurrent write
       - [ ] concurrent read and write
   - [x] added documentation for new or modified features or behaviors.
   - [ ] added Javadocs for most classes and all non-trivial methods.
   - [ ] added or updated version, __license__, or notice information
   - [x] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for code coverage.
   - [x] added integration tests.
   - [ ] been tested in a test IoTDB cluster.
   
   <hr>
   
   ##### Key changed/added classes (or packages if there are too many classes) 
in this PR
   
   - `iotdb-core/datanode/.../quotas/UserResourceQuotaManager`
   - `iotdb-core/datanode/.../quotas/CapacityResourceLimiter` / 
`LimiterAcquireResult`
   - `iotdb-core/datanode/.../quota/ShowUserResourceQuotaTask` / 
`SetUserResourceQuotaTask` / `DeleteUserResourceQuotaTask`
   - `iotdb-core/confignode/.../ClusterQuotaManager`
   - `iotdb-core/confignode/.../quota/SetUserResourceQuotaPlan` / 
`DeleteUserResourceQuotaPlan`
   - `iotdb-core/node-commons/.../quota/*`
   - `iotdb-protocol/thrift-{commons,datanode,confignode}` (quota + heartbeat 
usage snapshot)
   - `integration-test/.../IoTDBUserResourceQuotaIT`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to