mysql-binlog-connector-java
mysql-binlog-connector-java copied to clipboard
Support for status variables
Hi Shyiko,
At the moment we are using the open replicator fork that was until recently maintained by good people from zendesk, but since recently it has been deprecated in favor of mysql binlog connector. We haven't used mysql-binlog-connector before so now we are evaluating the possibility of using mysql binlog connector instead of open replicator for our in-house project (https://github.com/mysql-time-machine/replicator).
One thing that I could not find in mysql-binlog-connector is the support for status variables. I tried to dig in a bit and found this part of code:
inputStream.skip(inputStream.readInteger(2)); // status variables block
at
https://github.com/shyiko/mysql-binlog-connector-java/blob/eead0ec2338f7229ba74a7a04188f4967f13d4b7/src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/QueryEventDataDeserializer.java
We need this feature for some timezone corner cases (if you are interested, more than happy to share the details about use case). Would you be willing/interested to add support (or accept a pull request) for status variables?
Thanks, Bosko.
Hi @bdevetak.
My first choice would obviously be a PR :)
You don't have to change anything in mysql-binlog-connector-java to get you going, though. You can register custom EventDataDeserializer for Query event which instead of skipping status var block would do the same thing as in https://github.com/whitesock/open-replicator/blob/master/src/main/java/com/google/code/or/binlog/impl/parser/QueryEventParser.java#L73.
Hi Shyiko,
Thanks for the quick reply!
"You don't have to change anything in mysql-binlog-connector-java to get you going, though. You can register custom EventDataDeserializer "
This is actually super cool, very happy to see that option, it makes thinks nice and easy :) We are going to use that approach. In addition to custom deserializer we will add a custom event type (QueryEventDataWithStatusVariables) which will contain status variables and also we will add some additional classes for working with status variables.
Do you think, once we write this, should this code be merged to mysql-binlog-connector? To me it looks like the right place for it, but I don't know if you maybe want to keep the mysql-binlog-connector codebase minimal and not introduce these extra features to the library? Either way is good for us, we are happy to have it working :)
Cheers, Bosko.
It might. At the very least, this is a good candidate for 1.0.0. Let me know when it's done and we'll take it from there. Thank you! :bowing_man:
Sounds good, we will let you know when the changes are ready and we can take it from there.
Thank you for your help so far!
Cheers, Bosko.