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

ON UPDATE CURRENT_TIMESTAMP may lead to data inconsistency #44565

Closed
zyguan opened this issue Jun 10, 2023 · 0 comments · Fixed by #44566
Closed

ON UPDATE CURRENT_TIMESTAMP may lead to data inconsistency #44565

zyguan opened this issue Jun 10, 2023 · 0 comments · Fixed by #44566
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@zyguan
Copy link
Contributor

zyguan commented Jun 10, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

/* t */ drop table if exists t;
-- t >> 0 rows affected
/* t */ create table t (id int, val int, updated_at timestamp(0) not null default current_timestamp(0) on update current_timestamp(0), primary key (id, updated_at), key idx_updated_at (updated_at));
-- t >> 0 rows affected
/* t */ insert into t values (1, 10, '2023-06-10 22:30:00');
-- t >> 1 rows affected
/* t */ update t force index(primary) set val = 11 where updated_at = '2023-06-10 22:30:00';
-- t >> 1 rows affected
/* t */ admin check table t;
-- t >> E8134: data inconsistency in table: t, index: idx_updated_at, col: updated_at, handle: "{1, 1851072800110936064}", index-values:"KindMysqlTime 2023-06-10 22:33:27" != record-values:"KindMysqlTime 2023-06-10 22:30:00", compare err:<nil>

2. What did you expect to see? (Required)

No error reported by admin-check.

3. What did you see instead (Required)

Found data inconsistency.

4. What is your TiDB version? (Required)

v6.5.1, also affects master and all other versions.

@zyguan zyguan added type/bug The issue is confirmed as a bug. sig/execution SIG execution sig/transaction SIG:Transaction severity/critical labels Jun 10, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jun 10, 2023
@zyguan zyguan added affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. and removed may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jun 11, 2023
@zyguan zyguan added affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. labels Jun 11, 2023
@XuHuaiyu XuHuaiyu removed the sig/execution SIG execution label Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.2 affects-6.3 affects-6.4 affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. severity/critical sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants