Skip to content

Commit

Permalink
Merge pull request #88 from zendesk/ben/handle_commits
Browse files Browse the repository at this point in the history
handle COMMIT QUERY_EVENTs
  • Loading branch information
Ben Osheroff committed Sep 3, 2015
2 parents 50873eb + 5ad6f5c commit 67fd428
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.zendesk</groupId>
<artifactId>maxwell</artifactId>
<version>0.10.0-RC4</version>
<version>0.11.0-PRE1</version>
<packaging>jar</packaging>

<name>maxwell</name>
Expand Down
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().equals("COMMIT") ) {
// some storage engines(?) will output a "COMMIT" QUERY_EVENT instead of a XID_EVENT.
// 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 67fd428

Please sign in to comment.