shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

pipeline migration: parse binlog error when mysql column type is datetime(4) in increment task

Open dongyun-coder opened this issue 7 months ago • 0 comments

Which version of ShardingSphere did you use?

5.5.3-SNAPSHOT

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy

Expected behavior

Binlog parser should correctly handle datetime(4) columns with special value '0000-00-00 00:00:00.0000'

Actual behavior

in aws rds 8.0.32, the following table is allowed

CREATE TABLE reproduce_datetime_parse_error ( id bigint NOT NULL AUTO_INCREMENT, updated datetime(4) NOT NULL DEFAULT '0000-00-00 00:00:00.0000', PRIMARY KEY (id) ) ENGINE = InnoDB;

insert into reproduce_datetime_parse_error values ();

the normal time like '2025-05-27 12:39:09.0000' is ok, but the default value '0000-00-00 00:00:00' will happen parse error.

The reason -> Binlog parser do not read all bytes of column datetime(4), which should 7 bytes, but only read 5 bytes ,lost fractional seconds

When the parsing error occurs, the binlog client becomes corrupted

dongyun-coder avatar May 27 '25 04:05 dongyun-coder