refactor(append): Log mismatched offsets on takeover errors#4545
refactor(append): Log mismatched offsets on takeover errors#4545cjc25 wants to merge 1 commit intoGoogleCloudPlatform:masterfrom
Conversation
When takeover offset doesn't match the requested offset, logs are more useful if we know what each value was.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the observability of errors occurring during the creation of appendable object writers. By including specific offset values in the error message, it becomes easier to diagnose issues related to stale object views and metadata cache inconsistencies. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves error reporting in internal/storage/bucket_handle.go by including the specific offset values in the error message when a mismatch occurs. A review comment suggests using the %d format specifier instead of %v for these integer offsets to better align with idiomatic Go practices.
|
|
||
| if off != req.Offset { | ||
| err = fmt.Errorf("takeover offset for the created appendable object writer does not match the requested offset") | ||
| err = fmt.Errorf("takeover offset %v for the created appendable object writer does not match the requested offset %v", off, req.Offset) |
There was a problem hiding this comment.
For better clarity and adherence to Go's idiomatic practices, it's recommended to use the %d format specifier for integer types instead of the general %v. This makes the expected type more explicit to readers of the code.
| err = fmt.Errorf("takeover offset %v for the created appendable object writer does not match the requested offset %v", off, req.Offset) | |
| err = fmt.Errorf("takeover offset %d for the created appendable object writer does not match the requested offset %d", off, req.Offset) |
When takeover offset doesn't match the requested offset, logs are more useful if we know what each value was.