-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
multitenant: allow secondary tenants to split/scatter by default
AdminSplit and AdminScatter requests are subject to capability checks. Previously, these capabilities were codified in the "enabled" form. As such, by default, secondary tenants did not have the ability to perform these operations. This is in violation of what secondary tenants could do prior to 23.1, at a time before capabilities existed. Moreover, RESTORE/IMPORT rely on performing these operations for performance. This made disallowing these operations by default a performance regression. This patch flips the phrasing of how these capabilities are stored on the proto to use the "disable" verbiage. As such, secondary tenants are able to perform splits and scatters by default. As part of this change, we also clean up a testing knob that was used by various backup, CDC, and logictests to override capability checks in the authorizer. This isn't required with the new default behaviour. We also add some missing E2E tests for the `CanAdminUnsplit` capability which were missing when it was introduced. Fixes #96736 Release note: None
- Loading branch information
1 parent
c31c1ac
commit 57dd19c
Showing
36 changed files
with
241 additions
and
283 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
1 change: 0 additions & 1 deletion
1
pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_mr
This file contains 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
1 change: 0 additions & 1 deletion
1
pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_query_plan
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# cluster-opt: can-admin-split | ||
# LogicTest: 5node !metamorphic-batch-sizes | ||
|
||
statement ok | ||
|
1 change: 0 additions & 1 deletion
1
pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index
This file contains 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
19 changes: 5 additions & 14 deletions
19
pkg/ccl/multitenantccl/tenantcapabilitiesccl/testdata/can_admin_split
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,25 @@ | ||
query-sql-system | ||
SELECT * FROM [SHOW TENANT [10] WITH CAPABILITIES] WHERE capability_id = 'can_admin_split' | ||
SELECT * FROM [SHOW TENANT [10] WITH CAPABILITIES] WHERE capability_id = 'disable_admin_split' | ||
---- | ||
10 tenant-10 ready none can_admin_split false | ||
10 tenant-10 ready none disable_admin_split false | ||
|
||
exec-sql-tenant | ||
CREATE TABLE t(a INT) | ||
---- | ||
ok | ||
|
||
exec-privileged-op-tenant | ||
ALTER TABLE t SPLIT AT VALUES (0) | ||
---- | ||
pq: ba: AdminSplit [/Tenant/10/Table/104/1/0,/Min) RPC error: rpc error: code = Unauthenticated desc = client tenant does not have capability "can_admin_split" (*kvpb.AdminSplitRequest) | ||
|
||
update-capabilities | ||
ALTER TENANT [10] GRANT CAPABILITY can_admin_split=true | ||
---- | ||
ok | ||
|
||
# By default, we should be able to split. | ||
exec-privileged-op-tenant | ||
ALTER TABLE t SPLIT AT VALUES (0) | ||
---- | ||
ok | ||
|
||
update-capabilities | ||
ALTER TENANT [10] REVOKE CAPABILITY can_admin_split | ||
ALTER TENANT [10] GRANT CAPABILITY disable_admin_split=true | ||
---- | ||
ok | ||
|
||
exec-privileged-op-tenant | ||
ALTER TABLE t SPLIT AT VALUES (0) | ||
---- | ||
pq: ba: AdminSplit [/Tenant/10/Table/104/1/0,/Min) RPC error: rpc error: code = Unauthenticated desc = client tenant does not have capability "can_admin_split" (*kvpb.AdminSplitRequest) | ||
pq: ba: AdminSplit [/Tenant/10/Table/104/1/0,/Min) RPC error: rpc error: code = Unauthenticated desc = client tenant capability "disable_admin_split" prevents operation (*kvpb.AdminSplitRequest) |
34 changes: 34 additions & 0 deletions
34
pkg/ccl/multitenantccl/tenantcapabilitiesccl/testdata/can_admin_unsplit
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
query-sql-system | ||
SELECT * FROM [SHOW TENANT [10] WITH CAPABILITIES] WHERE capability_id = 'can_admin_unsplit' | ||
---- | ||
10 tenant-10 ready none can_admin_unsplit false | ||
|
||
exec-sql-tenant | ||
CREATE TABLE t(a INT) | ||
---- | ||
ok | ||
|
||
exec-privileged-op-tenant | ||
ALTER TABLE t UNSPLIT AT VALUES (0) | ||
---- | ||
pq: could not UNSPLIT AT (0): ba: AdminUnsplit [/Tenant/10/Table/104/1/0,/Min) RPC error: grpc: client tenant does not have capability "can_admin_unsplit" (*kvpb.AdminUnsplitRequest) [code 16/Unauthenticated] | ||
|
||
update-capabilities | ||
ALTER TENANT [10] GRANT CAPABILITY can_admin_unsplit=true | ||
---- | ||
ok | ||
|
||
exec-privileged-op-tenant | ||
ALTER TABLE t UNSPLIT AT VALUES (0) | ||
---- | ||
pq: could not UNSPLIT AT (0): key /Tenant/10/Table/104/1/0 is not the start of a range | ||
|
||
update-capabilities | ||
ALTER TENANT [10] REVOKE CAPABILITY can_admin_unsplit | ||
---- | ||
ok | ||
|
||
exec-privileged-op-tenant | ||
ALTER TABLE t UNSPLIT AT VALUES (0) | ||
---- | ||
pq: could not UNSPLIT AT (0): ba: AdminUnsplit [/Tenant/10/Table/104/1/0,/Min) RPC error: grpc: client tenant does not have capability "can_admin_unsplit" (*kvpb.AdminUnsplitRequest) [code 16/Unauthenticated] |
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.