-
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.
94644: tenantcapabilities: introduce TenantCapabilities proto r=ecwall a=arulajmani This commit adds the skeletal structure for a `TenantCapabilities` proto, which is intended to encapsulate capabilities for a specific tenant. Capabilities are intended to be stored in the `system.tenants` table, in its Info column. To that end, we modify `TenantInfo` to contain capabilities. However, actually populating this field through SQL is left to a future commit. Future commits will also add the infrastructure required to check a tenant's requests against its capabilities for "privileged" operations. For now, I've only accounted for the `CanAdminSplit` capability -- this will likely expand to a fuller set as we introduce other capabilities in the system. References #94643 Epic: CRDB-18503 Release note: None 94754: split: init replica lb splitter with global rand r=erikgrinaker a=kvoli In #93838 we started initializing a new seeded rand for use in the load based splitter's reservoir sampling algorithm. Previously, the splitter was initialized using the global rand. `rand.Source` heap allocates on init approximately 4kb. When initialized per-replica, this is problematic as nodes scale to large replica counts. This patch replaces initializing a new random source per-replica with using the global rand instead. This removes the heap allocation. This is shown below running `kv/splits/nodes=3/quiesce=true` (not at identical replica counts in the test, the proportions are the important part). before: ![image](https://user-images.githubusercontent.com/39606633/210825416-a940904f-47c9-4271-9692-11b40be927f4.png) after: ![image](https://user-images.githubusercontent.com/39606633/210825742-fc62ea6c-2125-44fe-ac07-984c22986089.png) resolves: #94752 resolves: #94737 Release note: None Co-authored-by: Arul Ajmani <[email protected]> Co-authored-by: Austen McClernon <[email protected]>
- Loading branch information
Showing
18 changed files
with
242 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,3 @@ query-sql | |
SELECT * FROM [SHOW SCHEDULES] WHERE label='hello'; | ||
---- | ||
|
||
|
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 |
---|---|---|
|
@@ -584,4 +584,3 @@ foofoo | |
baz | ||
show_cluster_backup | ||
show_database_backup | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") |
30 changes: 30 additions & 0 deletions
30
pkg/multitenant/tenantcapabilities/tenantcapabilitiespb/BUILD.bazel
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,30 @@ | ||
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") | ||
load("@rules_proto//proto:defs.bzl", "proto_library") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
|
||
proto_library( | ||
name = "tenantcapabilitiespb_proto", | ||
srcs = ["capabilities.proto"], | ||
strip_import_prefix = "/pkg", | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_github_gogo_protobuf//gogoproto:gogo_proto"], | ||
) | ||
|
||
go_proto_library( | ||
name = "tenantcapabilitiespb_go_proto", | ||
compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", | ||
proto = ":tenantcapabilitiespb_proto", | ||
visibility = ["//visibility:public"], | ||
deps = ["@com_github_gogo_protobuf//gogoproto"], | ||
) | ||
|
||
go_library( | ||
name = "tenantcapabilitiespb", | ||
embed = [":tenantcapabilitiespb_go_proto"], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities/tenantcapabilitiespb", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
get_x_data(name = "get_x_data") |
32 changes: 32 additions & 0 deletions
32
pkg/multitenant/tenantcapabilities/tenantcapabilitiespb/capabilities.proto
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,32 @@ | ||
// Copyright 2023 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
syntax = "proto3"; | ||
package cockroach.multitenant.tenantcapabilities.tenantcapabilitiespb; | ||
option go_package = "tenantcapabilitiespb"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
// TenantCapabilities encapsulates a set of capabilities[1] for a specific | ||
// tenant. Capabilities for a specific tenant are stored in the system.tenants | ||
// table and are checked against in KV when the tenant performs a privileged | ||
// operation. | ||
// | ||
// [1] Certain requests in the system are considered "privileged", and as such, | ||
// tenants are only allowed to perform them if they have the appropriate | ||
// capability. For example, performing an AdminSplit. | ||
message TenantCapabilities { | ||
option (gogoproto.equal) = true; | ||
|
||
// CanAdminSplit, if set to true, grants grants the tenant the ability to | ||
// successfully perform `AdminSplit` requests. | ||
bool can_admin_split = 1; | ||
}; | ||
|
Oops, something went wrong.