pingcap / pingcap/tidb

Enabling MDL may cause data / index inconsistency if 1PC / async commit is enabled.

Open
#71,106 2 comments 0 reactions 0 assignees View on GitHub
component/ddl may-affects-25.10 may-affects-26.3 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/critical sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

1. Enable the MDL and keep a running transaction in `TxnCtx.EnableMDL = false` state.
2. Switch the global MDL to `true`.
3. The transaction passes the schema check.
4. Run a DDL, as the transaction hasn't been registered, so it'll not wait for it and success directly.
5. The transaction continues with an outdated schema.

### 2. What did you expect to see? (Required)

The transaction reports an error: the schema is outdated.

### 3. What did you see instead (Required)

The transaction directly success, and cause inconsistency between data and index.

### 4. What is your TiDB version? (Required)

Contributor guide

Open the contributing guide

Research direction

Start by tracing the transaction schema check and the TxnCtx.EnableMDL path described in the reproduction, then reproduce the sequence with 1PC or async commit enabled. Done means the transaction reports an outdated-schema error after the global MDL switch and no data/index inconsistency occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.