pingcap / pingcap/tidb

StmtCommit should not be used inside foreign key executors

Open
#62,621 4 comments 1 reaction 1 assignee Claimed by @YangKeao View on GitHub
affects-6.5 affects-7.1 affects-7.5 affects-8.1 affects-8.5 severity/major sig/sql-infra type/bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.