Skip to content

Commit cb987df

Browse files
craig[bot]shubhamdhama
andcommitted
Merge #147598
147598: gossip: register `Gossip` service with DRPC server r=cthumuluru-crdb,shaikzakiriitm a=shubhamdhama Enable the `Gossip` service on the DRPC server in addition to gRPC. 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: #146472 Epic: CRDB-48925 Release note: None Co-authored-by: Shubham Dhama <[email protected]>
2 parents e90488e + a9d047a commit cb987df

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

pkg/gossip/gossip.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,20 @@ func NewTestWithLocality(
357357
return gossip
358358
}
359359

360+
type drpcGossip Gossip
361+
362+
// AsDRPCServer returns the DRPC server implementation for the Gossip service.
363+
func (n *Gossip) AsDRPCServer() DRPCGossipServer {
364+
return (*drpcGossip)(n)
365+
}
366+
367+
// Gossip implements the DRPC service. It receives gossiped information from a
368+
// peer node. The received delta is combined with the infostore, and this node's
369+
// own gossip is returned to requesting client.
370+
func (g *drpcGossip) Gossip(stream DRPCGossip_GossipStream) error {
371+
return (*Gossip)(g).gossip(stream)
372+
}
373+
360374
// AssertNotStarted fatals if the Gossip instance was already started.
361375
func (g *Gossip) AssertNotStarted(ctx context.Context) {
362376
if g.started {

pkg/gossip/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func (s *server) GetNodeMetrics() *Metrics {
103103
// The received delta is combined with the infostore, and this
104104
// node's own gossip is returned to requesting client.
105105
func (s *server) Gossip(stream Gossip_GossipServer) error {
106+
return s.gossip(stream)
107+
}
108+
109+
// gossip is the shared implementation for Gossip for both gRPC and DRPC.
110+
func (s *server) gossip(stream RPCGossip_GossipStream) error {
106111
args, err := stream.Recv()
107112
if err != nil {
108113
return err

pkg/server/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ func NewServer(cfg Config, stopper *stop.Stopper) (serverctl.ServerStartupInterf
408408
}
409409

410410
gossip.RegisterGossipServer(grpcServer.Server, g)
411+
if err := gossip.DRPCRegisterGossip(drpcServer, g.AsDRPCServer()); err != nil {
412+
return nil, err
413+
}
411414

412415
var dialerKnobs nodedialer.DialerTestingKnobs
413416
if dk := cfg.TestingKnobs.DialerKnobs; dk != nil {

0 commit comments

Comments
 (0)