Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-1534

MySQL Connector fails to parse DDL containing the keyword VISIBLE for index definitions

    Details

    • Steps to Reproduce:
      Hide

      Execute the following DDLs on the MySQL database which is configured in debezium

      CREATE SCHEMA IF NOT EXISTS `s1` DEFAULT CHARACTER SET utf8 ;
      USE `s1` ;
      
      CREATE TABLE IF NOT EXISTS `s1`.`t1` (
        `sid` INT NOT NULL AUTO_INCREMENT,
        `c1` VARCHAR(45) NOT NULL,
        PRIMARY KEY (`sid`),
        UNIQUE INDEX `c1_UNIQUE` (`c1` ASC) VISIBLE)
      ENGINE = InnoDB;
      
      Show
      Execute the following DDLs on the MySQL database which is configured in debezium CREATE SCHEMA IF NOT EXISTS `s1` DEFAULT CHARACTER SET utf8 ; USE `s1` ; CREATE TABLE IF NOT EXISTS `s1`.`t1` ( `sid` INT NOT NULL AUTO_INCREMENT , `c1` VARCHAR (45) NOT NULL , PRIMARY KEY (`sid`), UNIQUE INDEX `c1_UNIQUE` (`c1` ASC ) VISIBLE) ENGINE = InnoDB;

      Description

      MySQL Connector fails to parse DDL containing the keyword VISIBLE for index definitions.

      Following is the error in logs

      org.apache.kafka.connect.errors.ConnectException: no viable alternative at input 'CREATE TABLE IF NOT EXISTS `s1`.`t1` (\n  `sid` INT NOT NULL AUTO_INCREMENT,\n  `c1` VARCHAR(45) NOT NULL,\n  PRIMARY KEY (`sid`),\n  UNIQUE INDEX `c1_UNIQUE` (`c1` ASC) VISIBLE'
      	at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:230)
      	at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:208)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:508)
      	at io.debezium.connector.mysql.EventBuffer.consumeEvent(EventBuffer.java:155)
      	at io.debezium.connector.mysql.EventBuffer.add(EventBuffer.java:98)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1095)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:943)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:580)
      	at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:825)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: io.debezium.text.ParsingException: no viable alternative at input 'CREATE TABLE IF NOT EXISTS `s1`.`t1` (\n  `sid` INT NOT NULL AUTO_INCREMENT,\n  `c1` VARCHAR(45) NOT NULL,\n  PRIMARY KEY (`sid`),\n  UNIQUE INDEX `c1_UNIQUE` (`c1` ASC) VISIBLE'
      	at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40)
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:282)
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:121)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1078)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:812)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68)
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41)
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80)
      	at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:307)
      	at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:694)
      	at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:492)
      	... 7 more
      Caused by: org.antlr.v4.runtime.NoViableAltException
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2023)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467)
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393)
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:886)
      	... 14 more
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jpechanec Jiri Pechanec
                Reporter:
                ranjith_ Ranjith Reddy
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: