Skip to content

data inconsistent when time data type is pk  #4283

@wk989898

Description

@wk989898

What did you do?

  1. start a changefeed with mysql
  2. run sql
CREATE TABLE time_is_pk
(
    id time(3) NOT NULL,
    t  datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id)
);

INSERT INTO `time_is_pk`(id) VALUES ('517:51:04.777'),('-733:00:00.0011');
DELETE FROM `time_is_pk` WHERE id = '517:51:04.777';

What did you expect to see?

No response

What did you see instead?

The following tables contains inconsistent data

+-------------------------+---------+--------------------+----------------+---------+-----------+
|          TABLE          | RESULT  | STRUCTURE EQUALITY | DATA DIFF ROWS | UPCOUNT | DOWNCOUNT |
+-------------------------+---------+--------------------+----------------+---------+-----------+
| `common_1`.`time_is_pk` | succeed | true               | +1/-1          |       1 |         1 |
+-------------------------+---------+--------------------+----------------+---------+-----------+

fix sql

-- table: common_1.time_is_pk
-- range in sequence: Full
DELETE FROM `common_1`.`time_is_pk` WHERE `id` = '-733:00:00.000' AND `t` = '2026-02-26 08:50:08' LIMIT 1;
REPLACE INTO `common_1`.`time_is_pk`(`id`,`t`) VALUES ('-733:00:00.001','2026-02-26 08:50:08');

Versions of the cluster

Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

(paste TiDB cluster version here)

Upstream TiKV version (execute tikv-server --version):

(paste TiKV version here)

TiCDC version (execute cdc version):

(paste TiCDC version here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions