Skip to content

Commit

Permalink
server: don't log for missing locality
Browse files Browse the repository at this point in the history
Previously we would always log a message that the locality was unknown
for requests from sql gateways. We should remove unnecessary logs from
traces.

Epic: none

Release note: None
  • Loading branch information
andrewbaptist committed Apr 12, 2024
1 parent e37b1f1 commit aa89e09
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/kv/kvpb/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2873,9 +2873,10 @@ message Header {
// current batch. When set, it allows the server to handle pushes and write
// too old conditions locally.
bool can_forward_read_timestamp = 16;
// gateway_node_id is the ID of the gateway node where the request originated.
// For requests from tenants, this is set to the NodeID of the KV node handling
// the BatchRequest.
// gateway_node_id is the ID of the gateway node where the request
// originated. For requests from a shared-process cluster, this is set to the
// NodeID of the KV node which created the BatchRequest. For requests from a
// separate-process SQL Pod or a CLI, this is set to 0.
int32 gateway_node_id = 11 [(gogoproto.customname) = "GatewayNodeID",
(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"];
// client_range_info represents the kvclient's knowledge about the state of
Expand Down
6 changes: 6 additions & 0 deletions pkg/server/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,12 @@ func (n *Node) getLocalityComparison(
return roachpb.LocalityComparisonType_UNDEFINED
}

// In separate-process multi-tenant mode the gatewayNodeID is 0.
if gatewayNodeID == 0 {
if _, ok := roachpb.ClientTenantFromContext(ctx); ok {
return roachpb.LocalityComparisonType_UNDEFINED
}
}
gatewayNodeDesc, err := gossip.GetNodeDescriptor(gatewayNodeID)
if err != nil {
log.VInfof(ctx, 2,
Expand Down

0 comments on commit aa89e09

Please sign in to comment.