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

unexpected result when executing DDL and DML concurrently #15386

Closed
killua525 opened this issue Mar 15, 2020 · 6 comments · Fixed by #15539
Closed

unexpected result when executing DDL and DML concurrently #15386

killua525 opened this issue Mar 15, 2020 · 6 comments · Fixed by #15539
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@killua525
Copy link

killua525 commented Mar 15, 2020

CODE master

create table t (a int, b int)
insert into t values(1,1);

connection 1

alter table t drop column b;

connection2

update t  set a=2,b=2;
update t set a=10,where b=2;
select * from t;

result
mysql> Select * from t;
+------+
| a |
+------+
| 2 |
+------+
1 row in set (0.00 sec)

@zz-jason
Copy link
Member

Could you describe the order of executing these SQLs to help us reproduce this issue? For example, describe them in this form:

time connection 1 connection 2
t1 xxx
t2 xxx

Also, what's the tidb version are you using?

@zz-jason
Copy link
Member

/cc @lysu

@zz-jason zz-jason added the type/question The issue belongs to a question. label Mar 15, 2020
@zz-jason zz-jason changed the title DDL Drop Column ,dml 数据不一致? unexpected result when executing DDL Drop Column, and dml concurrently Mar 15, 2020
@zz-jason zz-jason changed the title unexpected result when executing DDL Drop Column, and dml concurrently unexpected result when executing DDL and DML concurrently Mar 15, 2020
@killua525
Copy link
Author

killua525 commented Mar 16, 2020

Could you describe the order of executing these SQLs to help us reproduce this issue? For example, describe them in this form:

time connection 1 connection 2
t1 xxx
t2 xxx
Also, what's the tidb version are you using?

time connection1 connection2
t1 drop column
t2 column state(write only) update t set a =2 ,b=2
t3 column state (write only) update t set a=20 where b=2
t4 column state (none) select * from t

tidb3.0.5 or master
i think this issue in all version

@zimulala
Copy link
Contributor

@jzdxeb
I cannot reproduce this problem with the master version. Could you describe to us the steps for reproduction? And how do you keep the TiDB on "write-only" state to execute the update statement?

@killua525
Copy link
Author

killua525 commented Mar 16, 2020

for easy to produce this problem you can add

diff --git a/ddl/column.go b/ddl/column.go
index f38a774d5..4489e9ad1 100644
--- a/ddl/column.go
+++ b/ddl/column.go
@@ -265,6 +265,7 @@ func onDropColumn(t *meta.Meta, job *model.Job) (ver int64, _ error) {
                job.SchemaState = model.StateDeleteOnly
                colInfo.State = model.StateDeleteOnly
                ver, err = updateVersionAndTableInfo(t, job, tblInfo, originalState != colInfo.State)
+               time.Sleep(50 * time.Second)
        case model.StateDeleteOnly:
                // delete only -> reorganization
                job.SchemaState = model.StateDeleteReorganization

@zimulala
Copy link
Contributor

@jzdxeb
Thank you very much for your feedback! I am working on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants