pingcap / pingcap/tidb

session: querying `information_schema` in stale read transaction silently closes the transaction

Open
#66,099 5 comments 0 reactions 0 assignees View on GitHub
affects-7.1 affects-7.5 affects-8.1 affects-8.5 severity/major sig/transaction type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

Querying `information_schema` tables inside a stale read transaction silently closes the transaction. Normal tables and other transaction types are not affected.

```sql
CREATE TABLE t (a INT);

-- OK: Normal tx + information_schema: transaction stays active
BEGIN;
SELECT @@tidb_current_ts; -- Returns a valid TSO
SELECT * FROM information_schema.tables LIMIT 1;
SELECT @@tidb_current_ts; -- Same TSO — transaction is intact
COMMIT;

-- OK: Stale read tx + normal table: transaction stays active
START TRANSACTION READ ONLY AS OF TIMESTAMP NOW() - INTERVAL 1 SECOND;
SELECT @@tidb_current_ts; -- Returns a valid TSO
SELECT * FROM t;
SELECT @@tidb_current_ts; -- Same TSO — transaction is intact
COMMIT;

-- BUG: Stale read tx + information_schema: transaction silently closed
START TRANSACTION READ ONLY AS OF TIMESTAMP NOW() - INTERVAL 1 SECOND;
SELECT @@tidb_current_ts; -- Returns a valid TSO, e.g. 464086063644672000
SELECT * FROM information_schema.tables LIMIT 1;
SELECT @@tidb_current_ts; -- Returns 0 — transaction is gone
```

The bug triggers only when **both** conditions are met: stale read transaction **and** `information_schema` access.

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

Querying `information_schema` tables inside a stale read transaction should not alter the transaction state. `@@tidb_current_ts` should keep its original TSO value until an explicit `COMMIT` or `ROLLBACK`.

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

After querying any `information_schema` table inside a stale read transaction, `@@tidb_current_ts` drops to `0` — the transaction is silently closed with no error or warning.

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

```
Release Version: v9.0.0-beta.2.pre-1132-gf4cf761
Edition: Community
Git Commit Hash: f4cf761aa1da427479f66a3f356d64299c24b26f
Git Branch: HEAD
UTC Build Time: 2026-01-28 17:25:02
GoVersion: go1.25.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic
```

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.