StmtCommit should not be used inside foreign key executors
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
There are `StmtCommit` usages inside foreign key executors. This can be problematic because
1. `StmtCommit` is supposed to be used when a statement finishes, not in the middle of a statement. Otherwise its definition is ambiguous
2. Once `StmtCommit`, these content cannot be rolled back. If this whole statement finally failed, all its changes should be rolled back but those "stmt committed" by the foreign key executor is left. One special case is a pessimistic DML retry when it failed to acquire the pessimistic lock.
### 1. Minimal reproduce step (Required)
No actual buggy scenario found yet.
### 2. What did you expect to see? (Required)
### 3. What did you see instead (Required)
### 4. What is your TiDB version? (Required)
All versions that support FK
Contributor guide
Assessment
This issue has not been assessed yet.