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: move the debug code to its respective teams #68327

Open
knz opened this issue Aug 2, 2021 · 4 comments
Open

cli: move the debug code to its respective teams #68327

knz opened this issue Aug 2, 2021 · 4 comments
Labels
A-cli-admin CLI commands that pertain to controlling and configuring nodes C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-server-and-security DB Server & Security

Comments

@knz
Copy link
Contributor

knz commented Aug 2, 2021

Currently the debug code is strewn across the entire cli package and dilutes its ownership.
This incurs two separate problems:

  • it makes the cli package hard to explore/understand for newcomers.
  • whenever a debug tool needs attention, it is unclear who is the team that should look into it.
  • when folk have questions, they don't know who to ask.

To address this, we propose to work as follows:

  1. move each debug command to a sub-package clidebug of its respective team home, as described in the table below.
  2. in the process of (1), extract bits of common functionality away from the cli package into shared sub-packages too. For example, the RPC client logic would belong to such a sub-package.

Tentative homes:

Owner Command Go function CLI Dependencies
Bulk I/O backup ccl.backupCmds None
Bulk I/O backup export ccl.exportDataCmd, None
Bulk I/O backup list-backups ccl.listBackupsCmd, None
Bulk I/O backup list-incremental ccl.listIncrementalCmd, None
Bulk I/O backup show ccl.showCmd, None
Bulk I/O job-trace debugJobTraceFromClusterCmd, SQL client
KV raft-log debugRaftLogCmd, None
KV range-data debugRangeDataCmd, None
KV range-descriptors debugRangeDescriptorsCmd None
KV reset-quorum debugResetQuorumCmd, RPC client
KV unsafe-remove-dead-replicas debugUnsafeRemoveDeadReplicasCmd, None
SQL Queries statement-bundle debugStatementBundleCmd, None
SQL Queries statement-bundle recreate debugBundleRecreateCmd, SQL client, demo cluster
SQL Schema doctor debugDoctorCmd, None
SQL Schema doctor examine cluster doctorExamineCmd SQL client
SQL Schema doctor examine zipdir doctorExamineCmd None
SQL Schema doctor recreate cluster doctorRecreateCmd, SQL client
SQL Schema doctor recreate zipdir doctorRecreateCmd, None
Server check-log-config debugCheckLogConfigCmd, Log flags
Server decode-proto debugDecodeProtoCmd, None
Server env debugEnvCmd, None
Server gossip-values debugGossipValuesCmd, RPC client
Server list-files debugListFilesCmd, RPC client
Server merge-logs debugMergeLogsCmd, None
Server zip debugZipCmd, RPC client
Storage ballast debugBallastCmd, None
Storage check-store debugCheckStoreCmd, None
Storage compact debugCompactCmd, None
Storage decode-key debugDecodeKeyCmd, None
Storage decode-value debugDecodeValueCmd, None
Storage encryption-active-key ccl.encryptionActiveKeyCmd None
Storage encryption-status ccl.encryptionStatusCmd None
Storage estimate-gc debugGCCmd, None
Storage keys debugKeysCmd, None
Storage pebble DebugPebbleCmd, None
Storage syncbench debugSyncBenchCmd, None
Storage synctest debugSyncTestCmd, None
TBD tsdump debugTimeSeriesDumpCmd, RPC client

Some observations:

  • the storage debug commands are standalone and can be migrated without trouble.
  • the SQL SChema and Bulk I/O debug commands only require a SQL connection and can be migrated once the SQL conn logic is encapsulated.
  • the Server and KV debug commands only require a RPC connection and can be migrated once the RPC conn logic is encapsulated (or, preferably, once we have an alternate mechanism to access the server than RPCs)
  • a bit more investigation is needed for the SQL queries statement bundle commands.

Jira issue: CRDB-8989

@knz knz added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Aug 2, 2021
@knz knz added this to To do in DB Server & Security via automation Aug 2, 2021
@blathers-crl blathers-crl bot added the T-server-and-security DB Server & Security label Aug 2, 2021
@knz knz added C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. A-cli-admin CLI commands that pertain to controlling and configuring nodes and removed C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. labels Aug 2, 2021
@knz
Copy link
Contributor Author

knz commented Aug 2, 2021

Which metadata would we like to preserve/collect for all debug commands:

  • owner team
  • whether the command establishes a connection to a server (if yes, how)
  • whether the command writes output to disk (i.e. is it safe to experiment)
  • what additional data/details to provide when opening a github issue based on that command
  • (optional) example use case where the command is useful

@knz
Copy link
Contributor Author

knz commented Aug 2, 2021

Pre-analysis on how to move the GRPC client conn code to a sub-package.

Where is it used?

  • in the listed debug commands above
  • cockroach gen haproxy
  • init, quit, node decommission, node recommission

@knz
Copy link
Contributor Author

knz commented Aug 2, 2021

Pre-analysis on how to move the SQL client conn code to a sub-package.

Where is it used?

  • in the listed debug commands above
  • auth-session sub-commands
  • import, nodelocal, userfile
  • node ls, node status
  • sql
  • statement-diag

@knz knz moved this from To do to Linked issues (from the roadmap columns on the right) in DB Server & Security Aug 2, 2021
@github-actions
Copy link

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
10 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli-admin CLI commands that pertain to controlling and configuring nodes C-cleanup Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior. T-server-and-security DB Server & Security
Projects
DB Server & Security
  
Linked issues (from the roadmap colum...
Development

No branches or pull requests

1 participant