Skip to content

Commit

Permalink
handle COMMIT query_events.
Browse files Browse the repository at this point in the history
I can't trigger this but some folks can.
  • Loading branch information
Ben Osheroff committed Sep 3, 2015
1 parent cf975c5 commit c63c8f0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/com/zendesk/maxwell/MaxwellParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,17 @@ private LinkedList<MaxwellAbstractRowsEvent> getTransactionEvents() throws Excep
break;
case MySQLConstants.QUERY_EVENT:
QueryEvent qe = (QueryEvent) v4Event;
// TODO: need to handle this case.
// The MySQL guys say some storage engines will output a "COMMIT" QUERY_EVENT at the
// end of the stream.
throw new RuntimeException("Unhandled QueryEvent: " + qe);

if ( qe.getSql().toString() == "COMMIT" ) {
// some storage engines(?) will output a "COMMIT" QUERY_EVENT instead of a XID_EVENT.

This comment has been minimized.

Copy link
@wushujames

wushujames Sep 18, 2015

Contributor

I believe MyISAM tables will emit a COMMIT instead of an XID_EVENT.

shyiko/mysql-binlog-connector-java#48

// not sure exactly how to trigger this.
if ( !list.isEmpty() )
list.getLast().setTXCommit();

return list;
} else {
throw new RuntimeException("Unhandled QueryEvent: " + qe);
}
case MySQLConstants.XID_EVENT:
XidEvent xe = (XidEvent) v4Event;
for ( MaxwellAbstractRowsEvent e : list )
Expand Down

0 comments on commit c63c8f0

Please sign in to comment.