Repository navigation
Remove CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD and DROP RESOURCE from the CREATE and DROP privilege groups - #129772
Conversation
`CREATE WORKLOAD`, `CREATE RESOURCE`, `DROP WORKLOAD` and `DROP RESOURCE` were children of the `CREATE` and `DROP` privilege groups, so a user holding only `GRANT CREATE ON *.*` (the usual grant for an application that creates databases and tables) could create a CPU resource and a workload named `default` with `max_concurrent_threads = 1`. The `workload` setting defaults to `default`, so every other user's queries were then scheduled through that workload, server-wide, until an administrator dropped it. The four access types become direct children of `ALL`, like `KILL QUERY` and `MOVE PARTITION BETWEEN SHARDS`: they are granted only explicitly or through `GRANT ALL`. The interpreters already check the individual flags, so only the access-type tree changes. No new privilege keyword is introduced, so every grant an upgraded server writes is still parsed by an older one. The embedded grant documentation and the workload scheduling docs are updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (round 1): no code findings
|
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
cc @pufit @serxa, could you review this and add the |
|
Workflow [PR], commit [f24239a] Summary: ✅
AI ReviewSummaryPR #129772 removes Final VerdictStatus: ✅ Approve. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 13 s compile time in total, 9 of them have a recent master baseline. |
|
@serxa WDYT? This change was requested by me. |
|
This is good. I was thinking of making more granular RBAC for workloads specifically (that respects hierarchy for multi-tenancy and also introduces a grant for accessing workloads from queries - it can only be covered by read-only setting constraints currently). But this PR at least closes an obvious gap. Thanks |
be49313
Related: #129033
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
CREATE WORKLOAD,CREATE RESOURCE,DROP WORKLOADandDROP RESOURCEare no longer part of theCREATEandDROPprivilege groups and have to be granted explicitly (GRANT ALLstill includes them). PreviouslyGRANT CREATE ON *.*was enough to create adefaultworkload that throttles the queries of every user. Users who manage workloads and resources throughGRANT CREATEorGRANT DROPneedGRANT CREATE WORKLOAD, CREATE RESOURCE, DROP WORKLOAD, DROP RESOURCE ON *.*. This includes grants saved before the upgrade:GRANT CREATE, CREATE WORKLOADwas saved asGRANT CREATE, andGRANT ALL ON *.*followed by a revoke on*.*as a list of groups. Ausers.xmlgrant list that revokesCREATEorDROPfromALLshould revoke these privileges as well.Description
On 26.3, 26.8, 26.9 and 26.10, a user whose only privilege is
GRANT CREATE ON *.*can runCREATE RESOURCE cpu (MASTER THREAD, WORKER THREAD),CREATE WORKLOAD allandCREATE WORKLOAD default IN all SETTINGS max_concurrent_threads = 1. Theworkloadsetting defaults todefault, so the queries of every other user are then scheduled through that workload. Measured on master: the same query of thedefaultuser went from 10 threads / 439 ms to 3 threads / 3538 ms, andsystem.schedulershowed its 355 CPU requests passing through the new/all/default/semaphorenode.GRANT DROP ON *.*likewise allows dropping the administrator's workloads and resources.Cause: in
AccessType.hthe four privileges are children of theCREATEandDROPgroups, and a group grant includes its children.Change: the four privileges become direct children of
ALL, likeKILL QUERY. The interpreters,ON CLUSTER,RESTOREofsystem.workloads/system.resourcesand thereadonly/allow_ddlchecks already check the individual privileges, so nothing else changes. No new privilege keyword is added, so every grant an upgraded server saves is still parsed by older servers; aWORKLOAD ADMINgroup can be added on top later. An older replica of a replicated access storage keeps the old meaning ofCREATEuntil it is upgraded.Requested by @ nikitamikhaylov.
Validation: the new test
05564_workload_resource_privileges_not_in_create_dropfails on master and passes 50/50 with randomized settings;01271_show_privilegesis updated.Workflow [PR]
Sync PR [sync-upstream/pr/129772]
Version info
26.11.1.2002-master(included in26.11and later)