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

kv: print traced query when failing the TestProxyTracing #135846

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

iskettaneh
Copy link
Contributor

This commit prints the traced query when TestProxyTracing test fails. This should help with debugging the failures.

References: #135493

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

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.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @iskettaneh)


-- commits line 2 at r1:
nit: kvclient or kvcoord


pkg/kv/kvclient/kvcoord/dist_sender_server_test.go line 4956 at r1 (raw file):

		).Scan(&msg, &tag, &loc); err != nil {
			// If we fail for any reason, print the trace to help debugging.
			printTrace()

Why do another SHOW TRACE FOR SESSION above if we're already doing it here?

Could we just do the t.Logf() here, given we have msg, tag, loc scanned already? Or, as part of the Fatalf string?

This commit prints the traced query when TestProxyTracing test fails.
This should help with debugging the failures.

References: cockroachdb#135493

Release note: None
Copy link
Contributor Author

@iskettaneh iskettaneh 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 @arulajmani)


pkg/kv/kvclient/kvcoord/dist_sender_server_test.go line 4956 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Why do another SHOW TRACE FOR SESSION above if we're already doing it here?

Could we just do the t.Logf() here, given we have msg, tag, loc scanned already? Or, as part of the Fatalf string?

I added another one because the one that already exists has some filters that limit the query to one row only. But what I really wanted was to print all the rows in the traced statement. Therefore, next time it fails, we should hopefully be able to understand what happend exactly.

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.

Reviewed all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @iskettaneh)


pkg/kv/kvclient/kvcoord/dist_sender_server_test.go line 4956 at r1 (raw file):

Previously, iskettaneh wrote…

I added another one because the one that already exists has some filters that limit the query to one row only. But what I really wanted was to print all the rows in the traced statement. Therefore, next time it fails, we should hopefully be able to understand what happend exactly.

Ack, I didn't look closely enough -- the query is different. Sounds good.

Separately, you may want to look at TestSecondaryTenantFollowerReadsRouting for an example of how we could write this test to not do this SQL parsing, and instead use a testing knob to trace. Given we're trying to print the trace here, I wonder if using testing knobs like TestSecondaryTenantFollowerReadsRouting would end up being cleaner.

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.

The comment about reworking the test is a nit. I don't want to block getting us a trace on the next failure, so feel free to address that in a separate PR (if you agree).

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

Copy link
Contributor Author

@iskettaneh iskettaneh left a comment

Choose a reason for hiding this comment

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

ack

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


pkg/kv/kvclient/kvcoord/dist_sender_server_test.go line 4956 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Ack, I didn't look closely enough -- the query is different. Sounds good.

Separately, you may want to look at TestSecondaryTenantFollowerReadsRouting for an example of how we could write this test to not do this SQL parsing, and instead use a testing knob to trace. Given we're trying to print the trace here, I wonder if using testing knobs like TestSecondaryTenantFollowerReadsRouting would end up being cleaner.

ack

@iskettaneh
Copy link
Contributor Author

TFTR

bors r+

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.

3 participants