-
Notifications
You must be signed in to change notification settings - Fork 679
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
Add support for specifying an end log_pos #357
Conversation
This is an interesting feature. |
Thanks for the reply - good questions! For my use case, I would always be passing a start and end position in the same file. If the current binlog file is exhausted, then I think perhaps it would be best to just stop there. We could add an |
@dongwook-chan any thoughts on how to proceed? I can add an |
@paulvic Before going any further, I need to take a look at code. |
@paulvic And please invite me as a collaborator to your repo, paulvic:patch-1. |
Seems like you made some changes in paulvic:patch-1 for your own sake. Plus, I think using boolean variable to 'should_continue' isn't the correct solution. |
Hi @dongwook-chan yes I'd still like to continue with this work. Your forked repo is fine with me. |
Hi @paulvic I'm no longer very active but I'm really excited to see intercom is using my code for something :D |
@paulvic
I'll be waiting for your reply before making any progress with the PR. |
@paulvic |
Hi @dongwook-chan, thanks for your help here. I added a comment to your proposed changes dongwook-chan@67d3a71.
Which commits are you referring to? There are just 3 commits, and I believe they're all related to this PR but maybe I'm misunderstanding 😄.
Yes 👍 , I would like the |
* Binlog event at end_pos is the last event to be read (end_pos is inclusive) * iter() ends when fetchone() returns None
Thank you for your review. You made a good point and the issue will be dealt with ASAP.
My bad, they're indeed related to this PR. Now I don't see any reason to remove commits. |
As paulvic pointed out in [the comment](dongwook-chan@67d3a71), iteration will be stalled indefinitely if there is no events to read past end_log_pos. `is_past_end_log_pos` attribute will be added to BinLogStreamReader to stop iteration even if it is the last event.
I've fixed the issue. |
@dongwook-chan - confirmed the fix works for me 👍 |
@noplay |
That 's awesome |
I have a use case where we want to read binary logs from a specific start position to a specific end position.
I was originally planning to just filter the events returned by the BinLogStreamReader but it just sits waiting in
self._stream_connection.read_packet()
and never returns the events (the DB has very sporadic low traffic).I was wondering if there would be an appetite to add support for an
end_log_pos
parameter? I've tested this out locally and it solves my problem by exiting the loop when we've moved past the end_pos.There may be a better way to achieve my goal here, so all feedback is appreciated. Thanks!