Skip to content

Commit b6286d7

Browse files
committed
server,cli: extract QuorumRecovery service and register with DRPC server
This is a follow-up to #145195, where we extracted `KVBatch` from the `Internal` service. Here, we do the same with `QuorumRecovery`. 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. Fixes: #148726 Epic: CRDB-48925 Release note: None
1 parent 449f097 commit b6286d7

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

pkg/cli/debug_reset_quorum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func runDebugResetQuorum(cmd *cobra.Command, args []string) error {
5353
defer finish()
5454

5555
// Call ResetQuorum to reset quorum for given range on target node.
56-
_, err = conn.NewInternalClient().ResetQuorum(ctx, &kvpb.ResetQuorumRequest{
56+
_, err = conn.NewQuorumRecoveryClient().ResetQuorum(ctx, &kvpb.ResetQuorumRequest{
5757
RangeID: int32(rangeID),
5858
})
5959
if err != nil {

pkg/cli/rpc_clients.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type rpcConn interface {
2727
NewAdminClient() serverpb.RPCAdminClient
2828
NewInitClient() serverpb.RPCInitClient
2929
NewTimeSeriesClient() tspb.RPCTimeSeriesClient
30-
NewInternalClient() kvpb.RPCInternalClient
30+
NewQuorumRecoveryClient() kvpb.RPCQuorumRecoveryClient
3131
}
3232

3333
// grpcConn is an implementation of rpcConn that provides methods to create
@@ -53,7 +53,7 @@ func (c *grpcConn) NewTimeSeriesClient() tspb.RPCTimeSeriesClient {
5353
return tspb.NewGRPCTimeSeriesClientAdapter(c.conn)
5454
}
5555

56-
func (c *grpcConn) NewInternalClient() kvpb.RPCInternalClient {
56+
func (c *grpcConn) NewQuorumRecoveryClient() kvpb.RPCQuorumRecoveryClient {
5757
return kvpb.NewGRPCInternalClientAdapter(c.conn)
5858
}
5959

@@ -80,8 +80,8 @@ func (c *drpcConn) NewTimeSeriesClient() tspb.RPCTimeSeriesClient {
8080
return tspb.NewDRPCTimeSeriesClientAdapter(c.conn)
8181
}
8282

83-
func (c *drpcConn) NewInternalClient() kvpb.RPCInternalClient {
84-
return kvpb.NewDRPCInternalClientAdapter(c.conn)
83+
func (c *drpcConn) NewQuorumRecoveryClient() kvpb.RPCQuorumRecoveryClient {
84+
return kvpb.NewDRPCQuorumRecoveryClientAdapter(c.conn)
8585
}
8686

8787
func makeRPCClientConfig(cfg server.Config) rpc.ClientConnConfig {

pkg/kv/kvpb/api.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3760,6 +3760,12 @@ service RangeFeed {
37603760
rpc MuxRangeFeed (stream RangeFeedRequest) returns (stream MuxRangeFeedEvent) {}
37613761
}
37623762

3763+
// QuorumRecovery offers RPC to reset the quorum for the given range on the target
3764+
// node.
3765+
service QuorumRecovery {
3766+
rpc ResetQuorum (ResetQuorumRequest) returns (ResetQuorumResponse) {}
3767+
}
3768+
37633769
// Batch and RangeFeed service implemented by nodes for KV API requests.
37643770
service Internal {
37653771
rpc Batch (BatchRequest) returns (BatchResponse) {}

pkg/server/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,9 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf
10011001
if err := kvpb.DRPCRegisterCluster(drpcServer, node); err != nil {
10021002
return nil, err
10031003
}
1004+
if err := kvpb.DRPCRegisterQuorumRecovery(drpcServer, node); err != nil {
1005+
return nil, err
1006+
}
10041007
kvserver.RegisterPerReplicaServer(grpcServer.Server, node.perReplicaServer)
10051008
if err := kvserver.DRPCRegisterPerReplica(drpcServer, node.perReplicaServer); err != nil {
10061009
return nil, err

0 commit comments

Comments
 (0)