Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row level checksum verification failed on timestamp column caused by time zone mistmatch #10573

Closed
3AceShowHand opened this issue Jan 31, 2024 · 2 comments · Fixed by #10564
Closed
Assignees
Labels
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. area/ticdc Issues or PRs related to TiCDC. severity/major type/bug The issue is confirmed as a bug.

Comments

@3AceShowHand
Copy link
Contributor

What did you do?

  1. Deploy TiDB cluster and TiCDC cluster.
  2. create a changefeed with row level checksum enabled.
  3. run the following SQL
set global tidb_enable_row_level_checksum=true;

set @@global.time_zone = '-05:00'

create table t (a int primary key, b timestamp);

insert into t values (1, '2023-02-09 13:00:00');

What did you expect to see?

The changefeed should verify the checksum correctly, and changefeed works normally.

What did you see instead?

The changefeed failed, and the reported error indicates that checksum mismatch.

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):

master
@3AceShowHand 3AceShowHand added type/bug The issue is confirmed as a bug. area/ticdc Issues or PRs related to TiCDC. labels Jan 31, 2024
@3AceShowHand 3AceShowHand self-assigned this Jan 31, 2024
@3AceShowHand
Copy link
Contributor Author

The error comes from timestamp handling logic.

  1. The TiDB receives the timestamp 2023-02-09 13:00:00, and calculates the checksum based on it, let's assume the resulting checksum is a.
  2. The TiDB converts the timestamp 2023-02-09 13:00:00 to UTC, which is 2023-02-09 18:00:00, and stores it into KV.
  3. TiCDC receives the raw kv value, and decodes the timestamp value by setting the time_zone as utf-8, which results in 2023-02-10 02:00:00.
  4. TiCDC calculates the checksum based on 2023-02-10 02:00:00, resulting in b. since a != b, so the checksum mismatch and error happen.

Solution

  1. The TiDB should convert the user input timestamp to UTC, and then calculate the checksum value.
  2. The TiCDC should also calculate the checksum based on UTC.

@fubinzh
Copy link

fubinzh commented Feb 2, 2024

/severity major

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. area/ticdc Issues or PRs related to TiCDC. severity/major type/bug The issue is confirmed as a bug.
Projects
2 participants