Skip to content

Commit

Permalink
kvclient: remove unused field from DistSender
Browse files Browse the repository at this point in the history
Remove the unused NodeDescriptor field from DistSender.

Epic: none

Release note: None
  • Loading branch information
andrewbaptist committed Dec 20, 2023
1 parent e2e88aa commit a8be34f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
15 changes: 1 addition & 14 deletions pkg/kv/kvclient/kvcoord/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"sync"
"sync/atomic"
"time"
"unsafe"

"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/gossip"
Expand Down Expand Up @@ -511,11 +510,6 @@ type DistSender struct {
log.AmbientContext

st *cluster.Settings
// nodeDescriptor, if set, holds the descriptor of the node the
// DistSender lives on. It should be accessed via getNodeDescriptor(),
// which tries to obtain the value from the Gossip network if the
// descriptor is unknown.
nodeDescriptor unsafe.Pointer
// clock is used to set time for some calls. E.g. read-only ops
// which span ranges and don't require read consistency.
clock *hlc.Clock
Expand Down Expand Up @@ -599,11 +593,7 @@ type DistSenderConfig struct {
// NodeIDGetter, if set, provides non-gossip based implementation for
// obtaining the local KV node ID. The DistSender uses the node ID to
// preferentially route requests to a local replica (if one exists).
NodeIDGetter func() roachpb.NodeID
// nodeDescriptor, if provided, is used to describe which node the
// DistSender lives on, for instance when deciding where to send RPCs.
// Usually it is filled in from the Gossip network on demand.
nodeDescriptor *roachpb.NodeDescriptor
NodeIDGetter func() roachpb.NodeID
RPCRetryOptions *retry.Options
RPCContext *rpc.Context
// NodeDialer is the dialer from the SQL layer to the KV layer.
Expand Down Expand Up @@ -675,9 +665,6 @@ func NewDistSender(cfg DistSenderConfig) *DistSender {
panic("no tracer set in AmbientCtx")
}

if cfg.nodeDescriptor != nil {
atomic.StorePointer(&ds.nodeDescriptor, unsafe.Pointer(cfg.nodeDescriptor))
}
var rdb rangecache.RangeDescriptorDB
if cfg.FirstRangeProvider != nil {
ds.firstRangeProvider = cfg.FirstRangeProvider
Expand Down
1 change: 0 additions & 1 deletion pkg/kv/kvclient/kvcoord/local_test_cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func NewDistSenderForLocalTestCluster(
NodeDescs: g,
RPCContext: rpcContext,
RPCRetryOptions: &retryOpts,
nodeDescriptor: nodeDesc,
NodeDialer: nodedialer.New(rpcContext, gossip.AddressResolver(g)),
FirstRangeProvider: g,
TestingKnobs: ClientTestingKnobs{
Expand Down

0 comments on commit a8be34f

Please sign in to comment.