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: tsdump should also create tsdump.gob.yaml #80478

Closed
tbg opened this issue Apr 25, 2022 · 3 comments
Closed

cli: tsdump should also create tsdump.gob.yaml #80478

tbg opened this issue Apr 25, 2022 · 3 comments
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@tbg
Copy link
Member

tbg commented Apr 25, 2022

Is your feature request related to a problem? Please describe.

To use a tsdump, one needs an associated node:store mapping (in a yaml file). However, the tsdump command does not produce this. With a debug.zip we will produce it like this:

tail -n +2 debug/crdb_internal.kv_store_status.txt | awk '{print $2 ": " $1}' > tsdump.gob.yaml

Describe the solution you'd like

Ideally the tsdump command creates one automatically by also loading the node:store mapping from the cluster through a status RPC.

Describe alternatives you've considered

The command could at least print the following SQL query to make the tsdump file:

db, err := c.ConnE(ctx, t.L(), node)
if err != nil {
return err
}
defer db.Close()
rows, err := db.QueryContext(
ctx,
` SELECT store_id, node_id FROM crdb_internal.kv_store_status`,
)
if err != nil {
return err
}
defer rows.Close()
var buf bytes.Buffer
for rows.Next() {
var storeID, nodeID int
if err := rows.Scan(&storeID, &nodeID); err != nil {
return err
}
fmt.Fprintf(&buf, "%d: %d\n", storeID, nodeID)
}
if err := rows.Err(); err != nil {
return err
}
if err := ioutil.WriteFile(tsDumpGob+".yaml", buf.Bytes(), 0644); err != nil {
return err
}
return ioutil.WriteFile(tsDumpGob+"-run.sh", []byte(`#!/usr/bin/env bash
COCKROACH_DEBUG_TS_IMPORT_FILE=tsdump.gob cockroach start-single-node --insecure
`), 0755)

We could also add a helper script to debug.zip that does the tail | awk above as a partial solution (a debug.zip is not always available or can be very large relative to the tsdump).

Additional context

Customer support increasingly relies on tsdump and the need to generate and distribute the yaml files tends to cause friction.

cc @rimadeodhar @daniel-crlabs

Jira issue: CRDB-15595

@tbg tbg added this to To do in Observability Infrastructure via automation Apr 25, 2022
@blathers-crl

This comment was marked as resolved.

@blathers-crl blathers-crl bot added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-observability-inf labels Apr 25, 2022
@jlinder jlinder added sync-me and removed sync-me labels May 20, 2022
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!

@daniel-crlabs
Copy link
Contributor

Interestingly enough, it's been so long since this request was made I completely forgot about it. I actually got around to make these changes myself and created a PR last week. See below:

cli: Enable cockroach debug tsdump to automatically create tsdump.yaml #114046

Once the PR above has been approved and merged this feature should be available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
No open projects
Development

No branches or pull requests

4 participants