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

ParsingException (MySQL 8): create trigger if exists

XMLWordPrintable

    • False
    • None
    • False
    • Critical

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      Debezium 2.7.0-SNAPSHOT

      What is the connector configuration?

      N/A

      What is the captured database version and mode of depoyment?

      MySQL 8.0.36

      What behaviour do you expect?

      The following statement should be parsed successfully for MySQL

      CREATE DEFINER=`root`@`127.0.0.1` TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.my_col, NEW._id); END

      This is valid statement in MySQL

       

       

      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 3918
      Server version: 8.0.36 Source distributionCopyright (c) 2000, 2024, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      mysql> CREATE TABLE `my_table` (
          ->   `_id` INT NOT NULL AUTO_INCREMENT,
          ->   `my_col` VARCHAR(20) DEFAULT NULL,
          ->   PRIMARY KEY (`_id`)
          -> );
      Query OK, 0 rows affected (0.09 sec)
      mysql> DELIMITER //
      mysql> CREATE TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.my_col, NEW._id); END;//
      Query OK, 0 rows affected (0.03 sec)mysql> DELIMITER ;
      mysql> 

       

      What behaviour do you see?

      Getting the following error:

      {"timestamp":"2024-05-17T14:18:25.557+03:00","sequence":2011,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"io.debezium.server.ConnectorLifecycle","level":"ERROR","message":"Connector completed: success = 'false', message = 'org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.', error = 'org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.'","threadName":"pool-7-thread-1","threadId":43,"mdc":{},"ndc":"","hostName":"t480","processName":"io.debezium.server.Main","processId":6664,"exception":{"refId":1,"exceptionType":"org.apache.kafka.connect.errors.ConnectException","message":"An exception occurred in the change event producer. This connector will be stopped.","frames":[{"class<span class="code-quote">":"io.debezium.pipeline.ErrorHandler","method":"setProducerThrowable","line":67},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":579},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":2,"exceptionType":"io.debezium.DebeziumException","message":"Error processing binlog event","frames":[{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":579},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":3,"exceptionType":"io.debezium.text.ParsingException","message":"DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE DEFINER=`root`@`127.0.0.1` TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.my_col, NEW._id); END'\nno viable alternative at input 'CREATE DEFINER=`root`@`127.0.0.1` TRIGGER IF NOT'","frames":[{"class<span class="code-quote">":"io.debezium.antlr.ParsingErrorListener","method":"syntaxError","line":43},{"class<span class="code-quote">":"org.antlr.v4.runtime.ProxyErrorListener","method":"syntaxError","line":41},{"class<span class="code-quote">":"org.antlr.v4.runtime.Parser","method":"notifyErrorListeners","line":543},{"class<span class="code-quote">":"org.antlr.v4.runtime.DefaultErrorStrategy","method":"reportNoViableAlternative","line":310},{"class<span class="code-quote">":"org.antlr.v4.runtime.DefaultErrorStrategy","method":"reportError","line":136},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"sqlStatements","line":1280},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"root","line":996},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":77},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":49},{"class<span class="code-quote">":"io.debezium.antlr.AntlrDdlParser","method":"parse","line":76},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseDdl","line":311},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseStreamingDdl","line":258},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleQueryEvent","line":726},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$5","line":179},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":559},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":4,"exceptionType":"org.antlr.v4.runtime.NoViableAltException","message":null,"frames":[{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"noViableAlt","line":2028},{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"execATN","line":467},{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"adaptivePredict","line":393},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"sqlStatements","line":1072},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"root","line":996},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":77},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":49},{"class<span class="code-quote">":"io.debezium.antlr.AntlrDdlParser","method":"parse","line":76},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseDdl","line":311},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseStreamingDdl","line":258},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleQueryEvent","line":726},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$5","line":179},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":559},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}]}}}}}}}} 

      Do you see the same behaviour using the latest relesead Debezium version?

      Yes, issue also exists on latest main branch.

      Do you have the connector logs, ideally from start till finish?

      {"timestamp":"2024-05-17T14:18:25.557+03:00","sequence":2011,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"io.debezium.server.ConnectorLifecycle","level":"ERROR","message":"Connector completed: success = 'false', message = 'org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.', error = 'org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.'","threadName":"pool-7-thread-1","threadId":43,"mdc":{},"ndc":"","hostName":"t480","processName":"io.debezium.server.Main","processId":6664,"exception":{"refId":1,"exceptionType":"org.apache.kafka.connect.errors.ConnectException","message":"An exception occurred in the change event producer. This connector will be stopped.","frames":[{"class<span class="code-quote">":"io.debezium.pipeline.ErrorHandler","method":"setProducerThrowable","line":67},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":579},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":2,"exceptionType":"io.debezium.DebeziumException","message":"Error processing binlog event","frames":[{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":579},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":3,"exceptionType":"io.debezium.text.ParsingException","message":"DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE DEFINER=`root`@`127.0.0.1` TRIGGER IF NOT EXISTS `my_trigger` BEFORE INSERT ON `my_table` FOR EACH ROW BEGIN SET NEW.my_col = CONCAT(NEW.my_col, NEW._id); END'\nno viable alternative at input 'CREATE DEFINER=`root`@`127.0.0.1` TRIGGER IF NOT'","frames":[{"class<span class="code-quote">":"io.debezium.antlr.ParsingErrorListener","method":"syntaxError","line":43},{"class<span class="code-quote">":"org.antlr.v4.runtime.ProxyErrorListener","method":"syntaxError","line":41},{"class<span class="code-quote">":"org.antlr.v4.runtime.Parser","method":"notifyErrorListeners","line":543},{"class<span class="code-quote">":"org.antlr.v4.runtime.DefaultErrorStrategy","method":"reportNoViableAlternative","line":310},{"class<span class="code-quote">":"org.antlr.v4.runtime.DefaultErrorStrategy","method":"reportError","line":136},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"sqlStatements","line":1280},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"root","line":996},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":77},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":49},{"class<span class="code-quote">":"io.debezium.antlr.AntlrDdlParser","method":"parse","line":76},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseDdl","line":311},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseStreamingDdl","line":258},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleQueryEvent","line":726},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$5","line":179},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":559},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}],"causedBy":{"exception":{"refId":4,"exceptionType":"org.antlr.v4.runtime.NoViableAltException","message":null,"frames":[{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"noViableAlt","line":2028},{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"execATN","line":467},{"class<span class="code-quote">":"org.antlr.v4.runtime.atn.ParserATNSimulator","method":"adaptivePredict","line":393},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"sqlStatements","line":1072},{"class<span class="code-quote">":"io.debezium.ddl.parser.mysql.generated.MySqlParser","method":"root","line":996},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":77},{"class<span class="code-quote">":"io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser","method":"parseTree","line":49},{"class<span class="code-quote">":"io.debezium.antlr.AntlrDdlParser","method":"parse","line":76},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseDdl","line":311},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogDatabaseSchema","method":"parseStreamingDdl","line":258},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleQueryEvent","line":726},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$5","line":179},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"handleEvent","line":559},{"class<span class="code-quote">":"io.debezium.connector.binlog.BinlogStreamingChangeEventSource","method":"lambda$execute$17","line":209},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"notifyEventListeners","line":1268},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"listenForEventPackets","line":1094},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient","method":"connect","line":653},{"class<span class="code-quote">":"com.github.shyiko.mysql.binlog.BinaryLogClient$7","method":"run","line":954},{"class<span class="code-quote">":"java.lang.Thread","method":"run","line":1570}]}}}}}}}} 

            Unassigned Unassigned
            einar-rt Einar Pihlap
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: