debezium / debezium/dbz

Exception on altering DATE fields with malformed default value [DBZ-3511]

Open
#459 0 comments 0 reactions 0 assignees View on GitHub
component/mysql-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-3511](https://issues.redhat.com/browse/DBZ-3511)

When altering MySQL with query
{code:java}
ALTER TABLE test_table_1 ALTER COLUMN data_type_DATE SET DEFAULT 123{code}
Connector fails with message
{code:java}
connect_1 | 2021-04-29 11:40:02,435 ERROR || WorkerSourceTask{id=mysql-connector-0} Task threw an uncaught and unrecoverable exception [org.apache.kafka.connect.runtime.WorkerTask] connect_1 | org.apache.kafka.connect.errors.ConnectException: Text '123' could not be parsed at index 0 connect_1 | at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:241) connect_1 | at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:218) connect_1 | at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:607) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.notifyEventListeners(BinaryLogClient.java:1104) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.listenForEventPackets(BinaryLogClient.java:955) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient.connect(BinaryLogClient.java:595) connect_1 | at com.github.shyiko.mysql.binlog.BinaryLogClient$7.run(BinaryLogClient.java:839) connect_1 | at java.base/java.lang.Thread.run(Thread.java:834) connect_1 | Caused by: java.time.format.DateTimeParseException: Text '123' could not be parsed at index 0{code}
 
 
*123* Is not a valid value for DATE field, but MySQL accepts this alter query and sets default value to {{2020-01-23}}

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the MySQL ALTER TABLE statement that sets a DATE default to 123, then trace the Debezium MySQL connector from binlog event handling through DATE default parsing. Compare the connector's behavior with MySQL's accepted default value; done means the connector no longer fails on this schema change and handles the resulting DATE value consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.