Skip to content
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

Resetting AUTO_INCREMENT in ALTER statement causes crash #112

Closed
Komnomnomnom opened this issue Sep 28, 2015 · 4 comments · Fixed by #113
Closed

Resetting AUTO_INCREMENT in ALTER statement causes crash #112

Komnomnomnom opened this issue Sep 28, 2015 · 4 comments · Fixed by #113

Comments

@Komnomnomnom
Copy link

Updating a table's AUTO_INCREMENT value causes maxwell to crash when it encounters the statement in the bin log.

Maxwell 0.11.2
MySQL 5.1.

Statement to reproduce

ALTER TABLE test_table AUTO_INCREMENT = 1
11:01:31,725 DEBUG SchemaChange - SQL_PARSE <- "ALTER TABLE test_table AUTO_INCREMENT = 1"
line 1:41 no viable alternative at input 'AUTO_INCREMENT'
11:01:31,751 ERROR MysqlParserListener - (alter_specification AUTO_INCREMENT = 1)
11:01:31,751 ERROR SchemaChange - Error parsing SQL: 'ALTER TABLE test_table AUTO_INCREMENT = 1'
com.zendesk.maxwell.schema.ddl.MaxwellSQLSyntaxError: AUTO_INCREMENT
    at com.zendesk.maxwell.schema.ddl.MysqlParserListener.visitErrorNode(MysqlParserListener.java:85)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:41)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52)
    at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52)
    at com.zendesk.maxwell.schema.ddl.SchemaChange.parse(SchemaChange.java:67)
    at com.zendesk.maxwell.MaxwellParser.processQueryEvent(MaxwellParser.java:284)
    at com.zendesk.maxwell.MaxwellParser.getEvent(MaxwellParser.java:251)
    at com.zendesk.maxwell.MaxwellParser.run(MaxwellParser.java:93)
    at com.zendesk.maxwell.Maxwell.run(Maxwell.java:73)
    at com.zendesk.maxwell.Maxwell.main(Maxwell.java:79)

I assume Maxwell should be safe to ignore this, or does it track the auto increment value?

@Komnomnomnom
Copy link
Author

Note that as well as the standalone query above it's also valid SQL to update the AUTO_INCREMENT in a regular ALTER statement. e.g.

ALTER TABLE `test_table`
    AUTO_INCREMENT=1,
    CHANGE COLUMN `test_col` `test_col` VARCHAR(21) NOT NULL COLLATE 'utf8_unicode_ci' FIRST;

This also causes maxwell to crash.

@osheroff
Copy link
Collaborator

released in v0.11.3

@osheroff
Copy link
Collaborator

btw, yeah, maxwell utterly ignores the auto_increment value, but it still needs to parse the SQL correctly to function.

@Komnomnomnom
Copy link
Author

So speedy! Fix works great, ty 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants