resume_stream attribute of BinLogStreamReader not working as documented
According to documentation, BinLogStreamReader starts from a given position if an specific position of the binlog file is assigned to log_pos and resume_stream = True. Nevertheless:
- when resume_stream = true, whatever value I assigned to log_pos, no past events are retrieved in the steam.
- when resume_tream = false, stream retrieves events since log_pos It seems the behaviour is different as the documented. Could you clarify it, please? Thanks in advance.
Same experience here, I am unable to reattach properly to the stream. In case of error in my processing pipeline I would like to start from this point and skip all previous events.
We are facing the same issue here.
Time a scarce resource. Feel free to contribute a fix or a test case for your usecases :)
resume_stream will take effect only when both log_file and log_pos are specified.
If any of log_file and log_pos are not specified, they are queried with show master status.
Just log_pos is not enough, log_file is necessary.
@YAtOff Correct.
In my opinion, mysql replication using log_file and log_pos is and has always been risky and difficult to operate. You should consider GTID and support is working fine in python-mysql-replication (the product I'm working on, is relying on it and it works flawlessly).
Had the same problem and ended up fetching the earliest log file by running SHOW BINARY LOGS - just take the first record and pass it to BinLogStreamReader (as log_file and log_pos).
Had the same issue too. Added a hacky way to keep track of the position via a file: https://github.com/wilbertom/python-mysql-replication/commit/3a3b38e11e300367dd812e3306f22317beef2d6d . Just leaving a breadcrumb in case someone needs some psudo code.
In production I will probably keep it in some database.