-
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.
Browse files
Browse the repository at this point in the history
95013: sql: add ability set, edit, read tenant capabilities r=knz a=ecwall Fixes #87851 Add new SQL syntax for 1) Setting tenant capabilities: `ALTER TENANT t GRANT CAPABILITY capabilitiy_name=capability_value;` 2) Resetting tenant capabilities: `ALTER TENANT t REVOKE CAPABILITIY capability_name;` 3) Reading tenant capabilities: `SHOW TENANT t WITH CAPABILITIES;` Release note: None 95797: sql: improve stack trace for get-user-timeout timeouts r=knz a=ecwall Fixes #95794 The cause of the `get-user-timeout` errors is unknown. Part of the problem is that the stack trace gets cut off at ``` | | github.com/cockroachdb/cockroach/pkg/sql.retrieveSessionInitInfoWithCache | | github.com/cockroachdb/cockroach/pkg/sql/user.go:238 ``` which does not explain what is actually being blocked. The reason that the stack trace is cut off is that the timeout is initiated by `contextutil.RunWithTimeout` which results in a "simple" (no stack trace) `context.DeadlineExceeded` error. `retrieveSessionInitInfoWithCache` is the first line in the stack trace because it calls `errors.Wrap` on `context.DeadlineExceeded`. To get a fuller stack trace, `context.DeadlineExceeded` must be wrapped immediately (`errors.Wrap` or `errors.WithStack`) before it bubbles up. Release note: None 95830: validate: use immutable descriptors only r=postamar a=postamar The descriptor validation logic will accept any implementation of catalog.Descriptor be it mutable or immutable, it doesn't care. However, using mutable implementations can have a significant performance impact especially in the case of tables, where every column or index or constraint lookup will lead to the cache being regenerated for the whole descriptor. This commit fixes this by having validate.Validate replace any mutable descriptor instances it encounters with immutable copies. This doesn't change anything except performance. Fixes #95827. Release note: None 95852: ui: cache sqlroles results r=maryliag a=maryliag Previously, the call to get sql roles was constantly being requested. This commits adds a cache limit, so it will only get request after the expiration time. https://www.loom.com/share/6814309f91234fa2b17490df8160bde6 Epic: None Release note: None 95863: storage: reorder EventListeners r=jbowens a=jbowens To be defensive, sequence the EventListener responsible for crashing the process during a disk stall first, before the Pebble logging event listener. Informs #94373. Epic: None Release note: None Co-authored-by: Evan Wall <[email protected]> Co-authored-by: Marius Posta <[email protected]> Co-authored-by: maryliag <[email protected]> Co-authored-by: Jackson Owens <[email protected]>
- Loading branch information
Showing
32 changed files
with
667 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
opt_show_tenant_options ::= | ||
'WITH' show_tenant_options |
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,7 +1,4 @@ | ||
show_tenant_stmt ::= | ||
'SHOW' 'TENANTS' | ||
| 'SHOW' 'TENANT_ALL' 'ALL' | ||
| 'SHOW' 'TENANTS' 'WITH' 'REPLICATION' 'STATUS' | ||
| 'SHOW' 'TENANT_ALL' 'ALL' 'WITH' 'REPLICATION' 'STATUS' | ||
| 'SHOW' 'TENANT' tenant_spec | ||
| 'SHOW' 'TENANT' tenant_spec 'WITH' 'REPLICATION' 'STATUS' | ||
'SHOW' 'TENANTS' opt_show_tenant_options | ||
| 'SHOW' 'TENANT_ALL' 'ALL' opt_show_tenant_options | ||
| 'SHOW' 'TENANT' tenant_spec opt_show_tenant_options |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tenant_capability ::= | ||
var_name | ||
| var_name to_or_eq var_value |
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,2 @@ | ||
tenant_capability_list ::= | ||
tenant_capability ( ( ',' tenant_capability ) )* |
43 changes: 43 additions & 0 deletions
43
pkg/ccl/logictestccl/testdata/logic_test/tenant_capability
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,43 @@ | ||
# LogicTest: local | ||
|
||
statement ok | ||
SELECT crdb_internal.create_tenant(5, 'five') | ||
|
||
statement error error parsing capability "not_a_capability": invalid capability | ||
ALTER TENANT [5] GRANT CAPABILITY not_a_capability=true | ||
|
||
statement error error parsing capability "can_admin_split": value must be bool | ||
ALTER TENANT [5] GRANT CAPABILITY can_admin_split=1 | ||
|
||
statement error error parsing capability "not_a_capability": invalid capability | ||
ALTER TENANT [5] REVOKE CAPABILITY not_a_capability | ||
|
||
statement error error parsing capability "can_admin_split": revoke must not specify value | ||
ALTER TENANT [5] REVOKE CAPABILITY can_admin_split=false | ||
|
||
query ITTTT colnames | ||
SHOW TENANT 'five' WITH CAPABILITIES | ||
---- | ||
id name status capability_name capability_value | ||
5 five ACTIVE can_admin_split false | ||
5 five ACTIVE can_admin_unsplit false | ||
|
||
statement ok | ||
ALTER TENANT [5] GRANT CAPABILITY can_admin_split=true | ||
|
||
query ITTTT colnames | ||
SHOW TENANT 'five' WITH CAPABILITIES | ||
---- | ||
id name status capability_name capability_value | ||
5 five ACTIVE can_admin_split true | ||
5 five ACTIVE can_admin_unsplit false | ||
|
||
statement ok | ||
ALTER TENANT [5] REVOKE CAPABILITY can_admin_split | ||
|
||
query ITTTT colnames | ||
SHOW TENANT 'five' WITH CAPABILITIES | ||
---- | ||
id name status capability_name capability_value | ||
5 five ACTIVE can_admin_split false | ||
5 five ACTIVE can_admin_unsplit false |
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
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
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.