Skip to content

Feature/user resource quota#18202

Open
hongzhi-gao wants to merge 4 commits into
apache:masterfrom
hongzhi-gao:feature/user-resource-quota
Open

Feature/user resource quota#18202
hongzhi-gao wants to merge 4 commits into
apache:masterfrom
hongzhi-gao:feature/user-resource-quota

Conversation

@hongzhi-gao

Copy link
Copy Markdown
Contributor

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/memread_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)

This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • 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
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

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

Introduce ConfigNode persistence and DataNode acquire/release enforcement for CPU/MEMORY quotas, keep throttle quota backward compatible, and cover the path with UT/IT.
… scheduling fixes.

Add DELETE USER QUOTA, concrete acquire-reject reasons, temp-disk default
min(100GiB, disk/10), unlimited users in minGap scheduling, and CN SHOW rows
for all Running DataNodes via heartbeat usage snapshots.
Cover quota_enable/root/invalid attrs, partial merge, cross THROTTLE SHOW,
temp-disk isolation, and read_cpu release path from the requirements checklist.
Awaitility now ignores transient InconsistentDataException while space
quota usage catches up across DataNodes via heartbeat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant