-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: extract meta.db from 2.x Bolt file #27031
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
Conversation
devanbenz
left a comment
There was a problem hiding this 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!
|
|
||
| val := bucket.Get([]byte(meta.Filename)) | ||
| if val == nil { | ||
| return fmt.Errorf("key %q not found in bucket %q", meta.Filename, string(meta.BucketName)) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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) | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next release.
Utility to extract the TSM metadata (databases,
retention policies, shards) in binary or JSON
from an InfluxDB 2.x BoltDB file