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

Amend transaction can cause lost update #20912

Closed
zyguan opened this issue Nov 6, 2020 · 4 comments
Closed

Amend transaction can cause lost update #20912

zyguan opened this issue Nov 6, 2020 · 4 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/transaction SIG:Transaction type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@zyguan
Copy link
Contributor

zyguan commented Nov 6, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

/* init */ drop table if exists accounts;
/* init */ create table accounts(id int primary key, balance bigint);
/* init */ insert into accounts values(1, 100), (2, 0), (3, 1);

/* s1 */ begin;
/* s2 */ alter table accounts add column bb int default 10;
/* s2 */ update accounts set bb = 100 where 1;
/* s1 */ update accounts set balance = id where 1;
/* s1 */ commit;
/* s2 */ select * from accounts;

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

/* s2 */ select * from accounts;
-- s2 >> +----+---------+-----+
-- s2    | ID | BALANCE | BB  |
-- s2    +----+---------+-----+
-- s2    |  1 |       1 | 100 |
-- s2    |  2 |       2 | 100 |
-- s2    |  3 |       3 | 100 |
-- s2    +----+---------+-----+

3. What did you see instead (Required)

/* s2 */ select * from accounts;
-- s2 >> +----+---------+----+
-- s2    | ID | BALANCE | BB |
-- s2    +----+---------+----+
-- s2    |  1 |       1 | 10 |
-- s2    |  2 |       2 | 10 |
-- s2    |  3 |       3 | 10 |
-- s2    +----+---------+----+

4. What is your TiDB version? (Required)

release-4.0

@zyguan zyguan added the type/bug The issue is confirmed as a bug. label Nov 6, 2020
@zyguan
Copy link
Contributor Author

zyguan commented Nov 6, 2020

cc @cfzjywxk

@cfzjywxk cfzjywxk added the sig/transaction SIG:Transaction label Nov 10, 2020
@cfzjywxk cfzjywxk self-assigned this Nov 10, 2020
@cfzjywxk
Copy link
Contributor

We'll document about this by now.

@cfzjywxk cfzjywxk added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed severity/critical labels Nov 10, 2020
@cfzjywxk
Copy link
Contributor

This issue is converted to a feature-request in #21069.

@cfzjywxk cfzjywxk added type/feature-request Categorizes issue or PR as related to a new feature. and removed severity/critical type/bug The issue is confirmed as a bug. labels Nov 16, 2020
@Defined2014
Copy link
Contributor

amend txn is deprecated in v6.5.0, so close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/transaction SIG:Transaction type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

4 participants