Skip to content

Conversation

@davidby-influx
Copy link
Contributor

Utility to extract the TSM metadata (databases,
retention policies, shards) in binary or JSON
from an InfluxDB 2.x BoltDB file

Copy link

@devanbenz devanbenz left a comment

Choose a reason for hiding this comment

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

This lgtm, I have been using it locally and it works as expected. Thanks!

@davidby-influx davidby-influx merged commit 216beca into main-2.x Dec 22, 2025
25 checks passed
@davidby-influx davidby-influx deleted the DSB/extract_meta branch December 22, 2025 20:13

val := bucket.Get([]byte(meta.Filename))
if val == nil {
return fmt.Errorf("key %q not found in bucket %q", meta.Filename, string(meta.BucketName))
Copy link
Member

Choose a reason for hiding this comment

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

I was confused by meta.Filename here, but it looks like this is correct. There is a meta.metadataKey that makes it more clear that this really is a key name. Making meta.metadataKey public and using it here might make the code easier to comprehend in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Next release. Merged before I saw this.

Comment on lines +82 to +92
if outputPath == "" || outputPath == "-" {
// Write to stdout
if _, err = os.Stdout.Write(jsonData); err != nil {
return fmt.Errorf("failed to write JSON to stdout: %w", err)
}
} else {
if err := os.WriteFile(outputPath, jsonData, 0644); err != nil {
return fmt.Errorf("failed to write output file %s: %w", outputPath, err)
}
fmt.Fprintf(os.Stderr, "wrote JSON to %s\n", outputPath)
}
Copy link
Member

Choose a reason for hiding this comment

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

This is some Claude duplication, but consolidating the logic to open the output file or write to stdout might be nice. Right now it's repeated for the JSON and non-JSON code paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants