-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
unexpected timestamp value for timestamp type at the write-only DDL state #29585
Comments
Thanks for reporting this bug! @zimulala PTAL |
My script is like this. Hope help.
|
The simplified reproduction process is as follows:
TiDB result:
|
@maxshuang The main reason is the difference between the time zone when the column type is converted and the time zone when the data is inserted. It is difficult to control the time zone in which data is inserted (the time zone may vary from TiDB to TiDB when writing reorg). |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Background : I am testing the behavior of the online DDL of tidb, so I add some delay to ddl state change to observe and test the state change process. Detail Is follows:
https://github.com/pingcap/tidb/blob/master/ddl/ddl_worker.go#L904
From:
To
Or you can use another way to simulate state delay when doing a ddl change( remove the etcd update may be help).
Then:
3 db, 3 kv, 1 pd, db is the one we modify upper.
create table test.t1(id int primary key, c1 timestamp default '2020-09-12 12:03:04')
alter table test.t1 modify column c1 bigint default 333333333;
At the mean time, we insert data with an incremental id value and default c1 value: insert into test.t1(id) values($i)
By the 3,4 step above, we can observe the behavior of ddl at different state:
absent-> delete-only->write-only->write-reorg->public
2. What did you expect to see? (Required)
3. What did you see instead (Required)
A strange value appear at the table, detail:
id is [100, 124], value for c1 is 20200912040304 ----> unexpected, why??
id is [125, 206], value for c1 is 20200912120304 ----> expected, insert at write-only ~ public
id is [207, ~], value for c1 is 333333333 ----> expected, insert at public
4. What is your TiDB version? (Required)
Release Version: v5.3.0-alpha-1304-ga96deab-dirty
Edition: Community
Git Commit Hash: a96deab
Git Branch: master
UTC Build Time: 2021-11-04 10:02:29
GoVersion: go1.16.7
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
The text was updated successfully, but these errors were encountered: