-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Is delayForAsyncCommit needed before verify records by foreign_key and constraints check? #48297
Comments
PTAL @crazycs520 |
I've reproduced this issue by adding a new failpoint to the case model.StateWriteOnly:
err = checkForeignKeyConstrain(w, job.SchemaName, tblInfo.Name.L, &fkInfo, fkCheck)
if err != nil {
job.State = model.JobStateRollingback
return ver, err
}
failpoint.Eval(_curpkg_("afterCheckForeignKeyConstrain"))
tblInfo.ForeignKeys[len(tblInfo.ForeignKeys)-1].State = model.StateWriteReorganization
ver, err = updateVersionAndTableInfo(jobCtx, t, job, tblInfo, true)
if err != nil {
return ver, errors.Trace(err)
}
job.SchemaState = model.StateWriteReorganization Prepare:
Run: Execute this SQL in the first connections: Then both of these SQLs will succeed, and the foreign key constraint is broken. |
Great Great!! |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
I see there is delayForAsyncCommit before verifying records, for example:
tidb/pkg/ddl/partition.go
Lines 2496 to 2498 in 4f00ece
But there is no delay used by foreign_key and constraints check.
tidb/pkg/ddl/foreign_key.go
Line 672 in 4f00ece
tidb/pkg/ddl/constraint.go
Line 339 in 4f00ece
Is it a potential bug under async commit?
I don't known how to reproduce it to verify this question.
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: