debezium / debezium/dbz

Column with default UUID_SHORT() cannot be added [DBZ-8766]

Open
#68 0 comments 0 reactions 0 assignees View on GitHub
component/mariadb-connector migrated-from-jira type/bug
Dominant language
HTML
Stars
6
Forks
8
Avg merge
2d 19h
Merged PRs (30d)
1

Description

Migrated from [DBZ-8766](https://issues.redhat.com/browse/DBZ-8766)

h1. Bug report
h2. What Debezium connector do you use and what version?

MySqlConnector 3.1.0.Alpha2
h2. What is the connector configuration?

 
{code:java}
{
"name": "source-mariadb-direct-b-v1-0-20240306-1",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "XXXX",
"database.port": "3306",
"database.user": "XXX",
"database.password": "XXX",
"database.serverTimezone": "UTC",
"database.server.id": "XXX",
"topic.prefix": "source.mariadb.direct-v1-0",
"database.initial.statements": "SET SESSION max_statement_time=XXX;SET CHARACTER SET utf8mb4;",
"database.include.list": "dbname",
"table.include.list": "dbname.tablename,dbname.product_indicator",
"schema.history.internal.kafka.topic": "source.mariadb.direct-b-v1-0.history",
"schema.history.internal.kafka.bootstrap.servers": "XXX",
"schema.history.internal.kafka.recovery.poll.interval.ms": "1100",
"schema.history.internal.skip.unparseable.ddl": "true",
"schema.history.internal.store.only.monitored.tables.ddl": "true",
"include.schema.changes": "false",
"producer.override.compression.type": "zstd",
"producer.override.max.request.size": "2000000",
"errors.log.enable": "true",
"errors.log.include.messages": "true",
"transforms": "ExtractField",
"transforms.ExtractField.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
"transforms.ExtractField.field": "id",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"key.converter.schemas.enable": false,
"value.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter.schema.registry.url": "XXX",
"value.converter.schemas.enable": false,
"provide.transaction.metadata": true,
"snapshot.locking.mode": "none",
"schema.name.adjustment.mode": "avro"
}
} {code}
 

 
h2. What is the captured database version and mode of deployment?

RDS mariadb version 10.11.10
h2. What behavior do you expect?

The column uid to be added to the schema of product_indicator table
h2. What behavior do you see?

The column uid is not added to the schema of product_indicator table, so the connector fails on updating/adding records to the table.
h2. Do you see the same behaviour using the latest released Debezium version?

We are on the last Alpha available at the moment
h2. Do you have the connector logs, ideally from start till finish?
{code:java}
Ignoring unparseable DDL statement 'ALTER TABLE dbname.product_indicator ADD uid VARCHAR(32) DEFAULT UUID_SHORT() NOT NULL COMMENT 'Unique product indicator identifier.' AFTER id' (io.debezium.connector.binlog.BinlogDatabaseSchema)
io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'ALTER TABLE dbname.product_indicator ADD uid VARCHAR(32) DEFAULT UUID_SHORT() NOT NULL COMMENT 'Unique product indicator identifier.' AFTER id'
no viable alternative at input 'ALTER TABLE dbname.product_indicator ADD uid VARCHAR(32) DEFAULT UUID_SHORT'
at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:43)
at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310)
at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136)
at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1264)
at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:980)
at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:74)
at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:48)
at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:76)
at io.debezium.connector.binlog.BinlogDatabaseSchema.parseDdl(BinlogDatabaseSchema.java:311)
at io.debezium.connector.binlog.BinlogDatabaseSchema.parseStreamingDdl(BinlogDatabaseSchema.java:258)
at io.debezium.connector.binlog.BinlogStreamingChangeEventSource.handleQueryEvent(BinlogStreamingChangeEventSource.java:738)
at io.debezium.connector.binlog.BinlogStreamingChangeEventSource.lambda$execute$5(BinlogStreamingChangeEventSource.java:179)
at io.debezium.connector.binlog.BinlogStreamingChangeEventSource.handleEvent(BinlogStreamingChangeEventSource.java:571)
at io.debezium.connector.binlog.BinlogStreamingChangeEventSource.lambda$execute$17(BinlogStreamingChangeEventSource.java:209)
at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1281)
at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:1103)
at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:657)
at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:959)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: org.antlr.v4.runtime.NoViableAltException
at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2028)
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:1056){code}
h2. How to reproduce the issue using our [tutorial|https://github.com/debezium/debezium-examples/tree/main/tutorial] deployment?
* create a table with 1 column
* add a record to the table
* start debezium
* add a column with default value UUID_SHORT()
* the connector will fail when trying to update the record, because it will find only 1 column in the schema, but 2 columns in the update

 

Contributor guide

Open the contributing guide

Research direction

Start with the tutorial reproduction and trace the reported failure through BinlogDatabaseSchema.parseDdl and MySqlAntlrDdlParser.java; the stack trace also points to the generated MySqlParser.java. The work is done when an ALTER TABLE adding a column with DEFAULT UUID_SHORT() is parsed and the connector's schema includes the new uid column.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mariadb, mysql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.