-
Notifications
You must be signed in to change notification settings - Fork 169
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
Adding support Mariadb events, such as GTID and annotate rows event(sql) #45
Conversation
generally speaking I'd prefer inheritance over a bunch of I'd also like to see quite a few more tests around mariaDB functionality, if possible -- especially ensuring that we test all the various deserializers. |
ok, i will try to refact. |
import com.github.shyiko.mysql.binlog.event.deserialization.EventDeserializer.EventDataWrapper; | ||
import com.github.shyiko.mysql.binlog.event.deserialization.GtidEventDataDeserializer; | ||
import com.github.shyiko.mysql.binlog.event.deserialization.QueryEventDataDeserializer; | ||
import com.github.shyiko.mysql.binlog.event.deserialization.RotateEventDataDeserializer; |
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.
please leave the import style alone. everyone's editor has an opinion about how imports should be done and they're always changing back and forth. I personally do not care even a little bit but I'm tired of it changing all the time.
} | ||
} | ||
|
||
protected GtidSet newGtidSet(String gtidSet) { |
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.
rename: buildGtidSet
gtidSet = new GtidSet(fetchGtidPurged()); | ||
} | ||
} | ||
setupGtidToPurgedIfNeeded(); |
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.
rename: setupGtidSet
@@ -592,8 +572,7 @@ public void connect() throws IOException, IllegalStateException { | |||
ensureEventDataDeserializer(EventType.ROTATE, RotateEventDataDeserializer.class); | |||
synchronized (gtidSetAccessLock) { | |||
if (gtidSet != null) { | |||
ensureEventDataDeserializer(EventType.GTID, GtidEventDataDeserializer.class); | |||
ensureEventDataDeserializer(EventType.QUERY, QueryEventDataDeserializer.class); | |||
ensureGtidEventDataDeserializerIfNeeded(); |
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.
rename: ensureGtidEventDataDeserializer
QueryEventData queryEventData = (QueryEventData) EventDataWrapper.internal(event.getData()); | ||
String sql = queryEventData.getSql(); | ||
case ANNOTATE_ROWS: | ||
String sql = getQuerySql(event); |
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 you look at the implementation of getQuerySql
, you'll see that this is false sharing -- in the case of MariaDB's QUERY
event it bounces right back to the mysql-compatible getQuerySql
.
Therefore -- keep the implementation of the QUERY
case the same, just make a different impl for maria.
|
||
@Override | ||
protected void setupGtidToPurgedIfNeeded() throws IOException { | ||
//Mariadb ignore |
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.
does maria-db not support the gtid_purged
variable?
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.
yeah, u can find this in https://mariadb.com/kb/en/system-variable-differences-between-mariadb-100-and-mysql-56/
@Override | ||
protected void ensureGtidEventDataDeserializerIfNeeded() { | ||
if (isUseSendAnnotateRowsEvent()) { | ||
ensureEventDataDeserializer(EventType.ANNOTATE_ROWS, AnnotateRowsEventDataDeserializer.class); |
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.
i don't think we need all the isUseSendAnnotate
stuff. It's not going to hurt anything to have an unsed data deserializer in there.
needs some documentation about setting maria-db specific flags and such |
@wingerx Great effort, thanks! Does the code incorporate old PRs?
Thanks |
No, i think they are similar only in Mariadb |
dumpBinaryLogCommand = new DumpBinaryLogCommand(serverId, "", 0L, isUseSendAnnotateRowsEvent()); | ||
|
||
} else { | ||
dumpBinaryLogCommand = new DumpBinaryLogCommand(serverId, getBinlogFilename(), getBinlogPosition()); |
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.
There should be some different implementations of Mariadb,look at https://github.com/shyiko/mysql-binlog-connector-java/pull/135/commits/36fca51464ccb8eb900b2addc23ac7e6c1c623ff
hi, I haven't seen any activity on this in a while. Is this is a dead PR or is there a chance of it moving forward? I, like many others, am eagerly awaiting GTID support for mariadb :) |
Hi |
Hi @osheroff, could you maybe share any updates regarding the status in this PR? If you could let us know what is missing in order the changes to make it on master, would be happy to contribute and help to move forward with it. |
trying to get this going here #79 |
ANNOTATE_ROWS(160), MARIADB_GTID(162) MARIADB_GTID_LIST(163)
@osheroff pls check this PR, ths.