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

cli/doctor: address issues in the debug doctor command #104641

Merged
merged 3 commits into from
Jun 13, 2023

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Jun 9, 2023

Previously, the debug doctor had the following issues on master:

  1. Running the 23.1 / master doctor against older cluster versions would run into issues with the jobs tables since we started using a new crdb_internal table to get a similar view
  2. Quoted table names in a zip directory were not unescaped properly, which could lead to validation errors
  3. Added support for JSON based zipdirs which are the default on master

@fqazi fqazi requested review from a team as code owners June 9, 2023 01:54
@fqazi fqazi requested review from srosenberg and renatolabs and removed request for a team June 9, 2023 01:54
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@fqazi fqazi added the backport-23.1.x Flags PRs that need to be backported to 23.1 label Jun 9, 2023
pkg/cli/doctor.go Outdated Show resolved Hide resolved
if err != nil {
return errors.Wrapf(err, "failed to parse descriptor id %s", fields[0])
}
if checkIfFileExists(zipDirPath, "system.descriptor.txt") {
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm...this is sad. I wonder what made us missing the change of this part at the first place. Maybe the test should have been more end-to-end. It should have generated the debug zip from a test db instead of having the fixtures in the format it was expecting. But this is low priority and can be future refactoring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, let good point let me add this in a future PR using roachtest

Previously, the CLI debug doctor command was updated to be
able to read the crdb_internal.system_jobs. This table
doesn't exist on older releases, so the doctor command
could only be run against the latest releases. To address,
this patch adds support for running doctor against
different releases.

Epic: none
Fixes: cockroachdb#104352
Releases note (bug fix): Fixed a bug that prevented
debug doctor from running against older versions of
Cockroach.
Previously, when parsing the namespace entries
we did not handle quoted table names properly.
This patch addresses, this by unquoting entries
properly.

Fixes: cockroachdb#104347

Release note: None
Previously, the debug doctor command only worked on the
older text format from debug zips. A recent change on master
started generating JSON based formats, which are incompatible.
This patch adds support for reading either the JSON or
text based formats depending on the directory.

Epic: none

Release note: None
@fqazi
Copy link
Collaborator Author

fqazi commented Jun 13, 2023

@chengxiong-ruan TFTR!

@fqazi
Copy link
Collaborator Author

fqazi commented Jun 13, 2023

bors r+

@@ -313,6 +314,19 @@ FROM system.namespace`
stmt = `
SELECT id, status, payload, progress FROM "".crdb_internal.system_jobs
`
checkSystemJobs := `SELECT count(*) FROM "".crdb_internal.system_jobs LIMIT 1`
_, err = sqlConn.QueryRow(ctx, checkSystemJobs)
// On versions before 23.1, we have a new table called crdb_internal.system_jobs,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this supposed to say "after 23.1"

@craig
Copy link
Contributor

craig bot commented Jun 13, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants