-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Broker log recovery #2167
Broker log recovery #2167
Conversation
@@ -1017,6 +1009,19 @@ func NewTopicReader(path string, index uint64, streaming bool) *TopicReader { | |||
} | |||
} | |||
|
|||
// Seek seeks to a position the current segment. | |||
func (r *TopicReader) Seek(offset int64, whence int) (int64, error) { | |||
assert(whence == os.SEEK_CUR, "topic reader can only seek to a relative position") |
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.
Seems like you could remove this assert by simply having this function ignore whence
, and then calling Seek()
with os.SEEK_CUR
. Of course, you may wish to catch errors 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.
If someone passes a non-SEEK_CUR
in the future I want to catch it immediately. If I silently override it then it'll be a pain to debug.
+1, change looks good to me. I do have some questions about the Don't forget the CHANGELOG. |
👍 |
This pull request adds recovery to the messaging.Topic when opening. If any partial messages are found then the file is truncated at that point and started from there. This can occur when ungracefully shutting down a server. It can leave half written messages at the end of segments.
fabc4b4
to
ba3026f
Compare
…oker-recovery Conflicts: CHANGELOG.md
Mock implementation of various services
Overview
This pull request adds recovery to the messaging.Topic when opening. If any partial messages are found then the file is truncated at that point and started from there. This can occur when ungracefully shutting down a server. It can leave half written messages at the end of segments.