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

Crash if column collation specified in CREATE statement #93

Closed
Komnomnomnom opened this issue Sep 10, 2015 · 2 comments · Fixed by #95
Closed

Crash if column collation specified in CREATE statement #93

Komnomnomnom opened this issue Sep 10, 2015 · 2 comments · Fixed by #95

Comments

@Komnomnomnom
Copy link

Maxwell crashes if collation is specified in a CREATE statement.

MySQL version 5.1.73
Maxwell version 0.10.0

15:14:12,892 DEBUG SchemaPosition - Writing binlog position to maxwell.positions: BinlogPosition[mysql-binlog.000001:438782]
15:16:15,900 DEBUG SchemaChange - SQL_PARSE <- "CREATE TABLE `maxwell_collate_test` (
    `id` INT(10) NOT NULL AUTO_INCREMENT,
    `parent_id` INT(10) NULL DEFAULT NULL,
    `model` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
    `foreign_key` INT(10) NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX `parent` (`parent_id`),
    INDEX `foreign_key` (`foreign_key`),
    INDEX `model` (`model`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
ROW_FORMAT=COMPACT
AUTO_INCREMENT=371"
line 4:40 extraneous input 'COLLATE' expecting {',', ')', AUTO_INCREMENT, COLUMN_FORMAT, COMMENT, DEFAULT, NOT, NULL, ON, PRIMARY, STORAGE, UNIQUE}
line 4:48 missing '=' at ''utf8_unicode_ci''
15:16:15,940 ERROR MysqlParserListener - (create_specifications ( (create_specification (column_definition (name (id `id`)) (data_type (signed_type INT (length ( 10 )))) (column_options (nullability NOT NULL)) (column_options AUTO_INCREMENT))) , (create_specification (column_definition (name (id `parent_id`)) (data_type (signed_type INT (length ( 10 )))) (column_options (nullability NULL)) (column_options (default_value DEFAULT NULL)))) , (create_specification (column_definition (name (id `model`)) (data_type (string_type VARCHAR (length ( 255 )))) (column_options (nullability NULL)) (column_options (default_value DEFAULT NULL)))) <missing ')'>)
15:16:15,940 ERROR SchemaChange - Error parsing SQL: 'CREATE TABLE `maxwell_collate_test` (
    `id` INT(10) NOT NULL AUTO_INCREMENT,
    `parent_id` INT(10) NULL DEFAULT NULL,
    `model` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
    `foreign_key` INT(10) NULL DEFAULT NULL,
    PRIMARY KEY (`id`),
    INDEX `parent` (`parent_id`),
    INDEX `foreign_key` (`foreign_key`),
    INDEX `model` (`model`)
)
COLLATE='utf8_unicode_ci'
ENGINE=InnoDB
ROW_FORMAT=COMPACT
AUTO_INCREMENT=371'
com.zendesk.maxwell.schema.ddl.MaxwellSQLSyntaxError: <missing ')'>
    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 com.zendesk.maxwell.schema.ddl.SchemaChange.parse(SchemaChange.java:67)
    at com.zendesk.maxwell.MaxwellParser.processQueryEvent(MaxwellParser.java:208)
    at com.zendesk.maxwell.MaxwellParser.getEvent(MaxwellParser.java:194)
    at com.zendesk.maxwell.MaxwellParser.getEvent(MaxwellParser.java:200)
    at com.zendesk.maxwell.MaxwellParser.run(MaxwellParser.java:100)
    at com.zendesk.maxwell.Maxwell.run(Maxwell.java:69)
    at com.zendesk.maxwell.Maxwell.main(Maxwell.java:75)
2015-09-10 15:16:15,981 FATAL Unable to register shutdown hook because JVM is shutting down.
@osheroff
Copy link
Collaborator

thanks for the bug report @Komnomnomnom, will look into this today.

@Komnomnomnom
Copy link
Author

Thanks @osheroff. FYI this bug exists in latest Maxwell version 0.11.0-RC1 too (MySQL 5.1.59 this time).

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