-
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
*: add foreign key cascade delete when execute delete statement #38377
Conversation
Signed-off-by: crazycs520 <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-all-tests |
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
/run-mysql-test |
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
56fe5e0
to
75f7d46
Compare
/run-all-tests |
Signed-off-by: crazycs520 <[email protected]>
/run-build |
Signed-off-by: crazycs520 <[email protected]>
executor/adapter.go
Outdated
e, err := fkc.buildExecutor(ctx) | ||
if err != nil || e == nil { | ||
return err | ||
} | ||
if err := e.Open(ctx); err != nil { | ||
terror.Call(e.Close) | ||
return err | ||
} | ||
_, _, e, err = a.handleNoDelay(ctx, e, isPessimistic) | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite clear about the previous state assumptions, maybe it's better to add some descriptions to explain the safety, which states of a statement execution may change or may not change.
For example, should the executions refresh the for_update_ts
or they should always use the same one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, maybe I shouldn't reuse handleNoDelay
here, write an handleFKExecutor
method to handle it maybe better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored the logic here, PTAL
executor/foreign_key.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
err = ResetContextOfStmt(sctx, stmtNode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ResetContextOfStmt
is called by the execution framework. The function uildFKCascadePlan
does something the same as the framework does, maybe it's better to reuse the existing functions by making necessary changes to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It really doesn't quite fit here, so it has been deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored the logic here, PTAL
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
…into fk-cascade-delete
Signed-off-by: crazycs520 <[email protected]>
It's fixed now. |
/run-all-tests |
Signed-off-by: crazycs520 <[email protected]>
/merge |
This pull request has been accepted and is ready to merge. Commit hash: a5ca023
|
/build |
/run-build |
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
Signed-off-by: crazycs520 [email protected]
What problem does this PR solve?
Issue Number: close #38376
Problem Summary: add foreign key cascade delete when execute delete statement
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.