Skip to content

Commit 1dcc89f

Browse files
craig[bot]shubhamdhama
andcommitted
Merge #148450
148450: kv,server: extract TenantUsage and TenantSpanConfig and register with DRPC server r=cthumuluru-crdb a=shubhamdhama This is a follow-up to #145195, where we extracted `KVBatch` from the `Internal` service. Here, we do the same with `TenantUsage` and `TenantSpanConfig`. The TL;DR is that smaller services are easier to maintain and can be more smoothly migrated to DRPC. We also enable this service on the DRPC server. This is controlled by `rpc.experimental_drpc.enabled` (off by default). This change is part of a series and is similar to: #146926 Note: This only registers the service; the client is not updated to use the DRPC client, so this service will not have any functional effect. Epic: CRDB-48925 Release note: None Co-authored-by: Shubham Dhama <[email protected]>
2 parents 0569392 + 4eb55fb commit 1dcc89f

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

pkg/kv/kvpb/api.proto

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,6 +3684,34 @@ service TenantService {
36843684
rpc GetRangeDescriptors(GetRangeDescriptorsRequest) returns (stream GetRangeDescriptorsResponse) {}
36853685
}
36863686

3687+
// TenantUsage provides RPCs for secondary tenants to report resource
3688+
// consumption and get Request Units available.
3689+
service TenantUsage {
3690+
// TokenBucket is used by tenants to obtain Request Units and report
3691+
// consumption.
3692+
rpc TokenBucket (TokenBucketRequest) returns (TokenBucketResponse) {}
3693+
}
3694+
3695+
// TenantSpanConfig provides RPCs for secondary tenants to operate on span
3696+
// configs, such as reading and updating them.
3697+
service TenantSpanConfig {
3698+
// GetSpanConfigs is used to fetch the span configurations over a given
3699+
// keyspan.
3700+
rpc GetSpanConfigs(GetSpanConfigsRequest) returns (GetSpanConfigsResponse) {}
3701+
3702+
// GetAllSystemSpanConfigsThatApply is used to fetch all system span
3703+
// configurations that apply over a tenant's ranges.
3704+
rpc GetAllSystemSpanConfigsThatApply(GetAllSystemSpanConfigsThatApplyRequest) returns (GetAllSystemSpanConfigsThatApplyResponse) {}
3705+
3706+
// UpdateSpanConfigs is used to update the span configurations over given
3707+
// keyspans.
3708+
rpc UpdateSpanConfigs(UpdateSpanConfigsRequest) returns (UpdateSpanConfigsResponse) {}
3709+
3710+
// SpanConfigConformance is used to determine whether ranges backing the given
3711+
// keyspans conform to span configs that apply over them.
3712+
rpc SpanConfigConformance(SpanConfigConformanceRequest) returns (SpanConfigConformanceResponse) {}
3713+
}
3714+
36873715
// Batch and RangeFeed service implemented by nodes for KV API requests.
36883716
service Internal {
36893717
rpc Batch (BatchRequest) returns (BatchResponse) {}

pkg/server/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,12 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf
989989
if err := kvpb.DRPCRegisterTenantService(drpcServer, node.AsDRPCTenantServiceServer()); err != nil {
990990
return nil, err
991991
}
992+
if err := kvpb.DRPCRegisterTenantUsage(drpcServer, node); err != nil {
993+
return nil, err
994+
}
995+
if err := kvpb.DRPCRegisterTenantSpanConfig(drpcServer, node); err != nil {
996+
return nil, err
997+
}
992998
kvserver.RegisterPerReplicaServer(grpcServer.Server, node.perReplicaServer)
993999
if err := kvserver.DRPCRegisterPerReplica(drpcServer, node.perReplicaServer); err != nil {
9941000
return nil, err

0 commit comments

Comments
 (0)