Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: don't log for missing locality #122283

Merged

Conversation

andrewbaptist
Copy link
Collaborator

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

Copy link

blathers-crl bot commented Apr 12, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@andrewbaptist andrewbaptist marked this pull request as ready for review April 12, 2024 14:47
@andrewbaptist andrewbaptist requested review from a team as code owners April 12, 2024 14:47
@andrewbaptist
Copy link
Collaborator Author

This logging was quite annoying and useless on requests from sql pods.

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andrewbaptist)


pkg/server/node.go line 1566 at r1 (raw file):

	// We can't lookup the locality of SQL gateway nodes for cross locality
	// metrics, ignore them.
	if gatewayNodeID == 0 {

When do we expect this to be 0? The comment at:

// 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.
int32 gateway_node_id = 11 [(gogoproto.customname) = "GatewayNodeID",

would indicate it's set for all requests, including ones from SQL tenants. But evidently that's not the case -- so is this case unexpected to you?


pkg/server/node.go line 1572 at r1 (raw file):

	if err != nil {
		log.VInfof(ctx, 2,
			"failed to perform look up for node descriptor %v", err)

Should we be just deleting this log line instead of adding that extra if condition above?

@andrewbaptist
Copy link
Collaborator Author

Interesting, I hadn't noticed the comment on gateway_node_id in api.proto. The behavior is described here: c5d847f

and as that commit suggests it is only available in shared process multi-tenancy not in separate-process
multi-tenant. Looping in @yuzefovich for thoughts on how we should handle this case for SQL Pods.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just not log anything for separate process pods - we know that we are in such setup when GatewayNodeID is 0 and roachpb.ClientTenantFromContext returns ok=true.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andrewbaptist and @arulajmani)

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
@andrewbaptist andrewbaptist force-pushed the 2024-04-12-dont-log-unnecessarily branch from f57a032 to aa89e09 Compare April 12, 2024 17:38
@andrewbaptist
Copy link
Collaborator Author

Let's just not log anything for separate process pods - we know that we are in such setup when GatewayNodeID is 0 and roachpb.ClientTenantFromContext returns ok=true.

I updated the comment in api.proto as well to make this consistent. I agree it is worth logging in the case of a request that should have set it as it may help debugging. Can you validate my change to the comment as well as the check that is now in place.

I'm not 100% sure about whether a CLI will cause logging, but either way it is not overly important to suppress it in that case.

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andrewbaptist and @arulajmani)

@andrewbaptist
Copy link
Collaborator Author

bors r=yuzefovich

TFTR!

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @andrewbaptist)


pkg/kv/kvpb/api.proto line 2879 at r2 (raw file):

  // 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.

Thanks for capturing this here.

@craig craig bot merged commit cd9661a into cockroachdb:master Apr 12, 2024
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants